Skip to main content

Posts

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 Safari You can run your tests using any RC versions > 1.0 If 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 sometimes Try running your tests using *safariproxy Verify the path given for the safari executable - it should be something like: C:\ProgramFiles\Safari\Safari.exe If you are using version 5.1  Then you have to run your tests on RC version 1.0.3 only Also change your tests to run using *safariproxy Don'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 hostname Check the path you provided to the executable of the browser - verify its found on the same path on your remote location Now 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 running This happens because the RC isn't able to talk to your browser - though it initiates the browser but can't talk to it anymore Solution: Upgrade your RC :)  Running on a Headless Box Selenium can't run u

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

TechGig Webinar by Ashu Chandra - Test Execution and Reporting Overview Test Bed Preparation Environment where to test - ensure we have the rite version or the app server/database/application (AUT - app under test) Execute Tests Analyze unexpected behavior - this is when we see a difference in the expected result and actual result How to drill down What to look for not every unexpected behavior is a bug report bugs When we get a bug we should report the bug in crisp and clear way to dev so that dev can recreate it quickly bug lifecycle What stages does a bug go through exit criteria (when to stop testing) how much should we test report test findings best practices Test Bed Preparation Ensure you have required hardware/operating system availability of qa environment of interface applications If there are intermediate systems we should check their requirements too setup environment as per supported platform (DB version, app server version etc)

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 browser Once 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 listed You 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 bookmarks One change for Firefox 7

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 level If you have a beforemethod/beforetest/beforeclass annotation, then you should check for the groups listed under each annotation For 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

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 linux For 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 information For 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 version for ex: Linux 2.6.32-5-amd64 x86_64 where:  Linux - Kernel name 2.6.32-5-amd64 - Kernel version number x86_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).selenium.click("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).selenium.click("id=btnSearch"); // Then click on search button 6).selenium.waitForPageToLoad("30000"); // wait for popup to get all value from dal 7).selenium.click("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