Skip to main content


Showing posts from September, 2011

Selenium n Safari

For all those who are stuck running Selenium tests on Safari...
Here are a couple of tips:

If you are using any version before 5 of SafariYou can run your tests using any RC versions > 1.0If you tests doesn't run then please verify the following: Enable popup's on Safari - I know I sound silly but believe me thats the only issue sometimesTry running your tests using *safariproxyVerify the path given for the safari executable - it should be something like: C:\ProgramFiles\Safari\Safari.exeIf you are using version 5.1 Then you have to run your tests on RC version 1.0.3 onlyAlso change your tests to run using *safariproxyDon't forget enable pop ups :) 
Even after doing all this - you'll still need an All the Best!!! And if you have a choice then pls run your tests on Safari Mac :)

Issues Running Selenium Scripts Remotely

In real time we hardly have a simple setup like running on the same box which acts as a server and client :( So we might have to run the scripts remotely almost all the time...Well there might be issues while doing so...Here are some! Can't launch the browser at all:Check the host name you are using in your code first!There is a possibility that the DNS isn't able to map the hostname with the IP - so try running your tests specifying the IP instead of the hostnameCheck the path you provided to the executable of the browser - verify its found on the same path on your remote locationNow the final check is to verify you can run the browser version on the RC version for ex: you can't run FF7 on RC1 :) Browser Opens but tests aren't runningThis happens because the RC isn't able to talk to your browser - though it initiates the browser but can't talk to it anymoreSolution: Upgrade your RC :) Running on a Headless BoxSelenium can't run upright on headless boxes - …

Test Execution and Reporting - My Notes from a Seminar I attended!

TechGigWebinar by Ashu Chandra - Test Execution and Reporting


Test Bed PreparationEnvironment where to test - ensure we have the rite version or the app server/database/application (AUT - app under test)Execute TestsAnalyze unexpected behavior - this is when we see a difference in the expected result and actual resultHow to drill downWhat to look fornot every unexpected behavior is a bugreport bugsWhen we get a bug we should report the bug in crisp and clear way to devso that dev can recreate it quicklybug lifecycleWhat stages does a bug go throughexit criteria (when to stop testing)how much should we testreport test findingsbest practicesTest Bed Preparation Ensure you have required hardware/operating systemavailability of qa environment of interface applicationsIf there are intermediate systems we should check their requirements toosetup environment as per supported platform (DB version, app server version etc)SUT installation from version controlusually we shouldn't accep…

Difference between isVisible() and isElementPresent()

Many a times I wondered what's the difference between the two functions. Here is what I have:

isElementPresent() - This method basically tests if the element we are looking for is present somewhere on the page.

isVisible() - looks for display: none style tag - this might throw a null pointer if we aren't careful...thus to see if an element is visible first check if the element is present using isElementPresent() method. Then try checking if the element is visible!

Observe that isElementPresent() won't mind even if our element is not visible.

For ex:
lets say the below is the html code for a component on my test application:

now if you test the above component with
selenium.isElementPresent("testinput") - returns true!
selenium.isVisible("testinput") - returns false!

Export Bookmarks

There are alot of times when we would have to move the bookmarks from one machine to another for various reasons - backup/system migrations etc

So here is a one stop solution on various browsers:

On IE:

Go to View Menu on the browser --> Toolbars --> Check (click) the Favorites Toolbar if its not already checked - This will enable you to see the favorites toolbar on the browserOnce you see the Favorites toolbar, click on the "Favorites" menu button on the favorites toolbar. This will enable you to see a sidebar on the browser with your favorites listedYou will also see a "Add to Favorites" button with a side arrow. Click that side arrow to get a menu where you have an "Import and Export" option. Click the "Import and Export" option
On Firefox:

Go to Bookmarks Menu on the browser, then click "Organize Bookmarks" -- this will open a new window which has options to import/export bookmarksOne change for Firefox 7 is that "Organi…

Failing to Run a single Testng Group

We all have various testng groups added/modified/deleted each time we update our test cases. Many a times we would want to run only a single testng group though! Failing tests?

Pre Condition: My Test Automation Suite is based on Selenium-Ant-Testng

When we want to run a single testng group lets say "sereUnitTests":If you don't have a beforemethod/beforetest/beforeclass annotation, then you should check your code...Its possible that something went wrong at the code levelIf you have a beforemethod/beforetest/beforeclass annotation, then you should check for the groups listed under each annotationFor Ex: my beforemethod looks like this:@BeforeMethod(groups={"unit", "integration"})public void openReader() throws SeleniumException {// Some functionality}But I see that the group which I wanted to run isn't listed thus testng notices that there is a before method to be initiated before your actual tests run but then doesn't see your method name listed …

Linux Version Help

Want to know which version your linux box is? Simple question isn't it...

Run the following commands:

cat /etc/*-release - This will give the distro of your linuxFor Ex: for RHEL 5 it will give: Red Hat Enterprise Linux Server release 5 (Tikanga)lsb_release -a - The lsb_release command displays certain LSB (Linux Standard Base) and distribution-specific informationFor Ex:    LSB Version: :core-3.1-ia32 Distributor ID: RedHatEnterpriseClient Description: Red Hat Enterprise Linux Client release 5.4 (Tikanga) Release: 5.4 Codename: Tikanga uname -mrs - this will give you your kernel versionfor ex: Linux 2.6.32-5-amd64 x86_64where: Linux - Kernel name2.6.32-5-amd64 - Kernel version numberx86_64 - Machine hardware name (64 bit)

Running Firefox with Firebug

Many a times our XPATH's would fail on test execution. This is when we would want to run the browser with the firebug extension. Just add this section of code in your code: 
File file = new File("firebug-1.5.4.xpi");FirefoxProfile firefoxProfile = new FirefoxProfile();firefoxProfile.addExtension(file);WebDriver driver = new FirefoxDriver(firefoxProfile);

Error while running selenium script on IE6

The following is the code: 
1)"css=img[alt=\"Search\"]"); // For clicking Search Button 2).selenium.waitForPopUp("winSLocation", "30000"); // Wait for popup 3).selenium.selectWindow("name=winSLocation"); // Popup window 4).selenium.type("id=sLocation", "dal"); // dal Value assigning to the text in Pop up 5)"id=btnSearch"); // Then click on search button 6).selenium.waitForPageToLoad("30000"); // wait for popup to get all value from dal 7)"id=r1c1"); // to selecting the dal value from required values After 

Clicking the Search button (means 1st point )we are getting the following error in selenium RC Command history “file:///C:/DOCUME~1/yamunach/LOCALS~1/Temp/customProfileDir872f1cda4df44c588669558e67f77656/core/RemoteRunner.hta “ 

This Error is Occurrin…