My blog has moved!
You should be automatically redirected in 5 seconds. If not, visit http://samueladesoga.wordpress.com and update your bookmarks.
Showing posts with label xpath. Show all posts
Showing posts with label xpath. Show all posts

Thursday, 30 April 2009

Selenium Test execution speed on Safari vs Internet Explorer

I have been working on a selenium test suite that contains about 150 tests.
These test would normally take about 4hrs 30mins for it to execute to completion.

I tried to run same tests on Safari today, and it took exactly 1hr 9min. This is such a big difference 
and i think it is because of the extreme use of Xpath in the test suite. And as it is known thatXpath execute soooo slow in IE.

This is quite good as i have decided to run intraday tests in safari so as to get faster feedback, cos up until now i am unable to kick off these test because a test suite that takes 4hr 30min to executes would have taken almost half of my day and does little good.

I would be writing another post that talk about how to efficiently use Xpath in your tests whenever you need to ......


Any comments ............

Saturday, 8 November 2008

Internet Explorer doesnt handle xpath to locate images exceptionally well

So i have been doing a lot of selenium and the website i am trying to automate test for
doesnt have a lot of element with id, name, or any other HTML attributes that makes selenium testing a bit easier.

So i have been using of xpath, my intent was to click on an image and i have used the src attribute of the image element.

so my original command,

selenium.click ("xpath=//img[@src="location/of/image/on/disc"]");

This works excellently on firefox but on IE, i keep getting the error "Element not found!"

so after several tries, this definitely work on both IE and firefox ......

selenium.click ("xpath=//img[@contains(@href, "google.com")]");
The second parameter of the xpath "contains" a segment of the link that the image element points to.Note that the img element has a href and that is why i am able to use the "contains" method of the xpath to locate the img.

Monday, 3 November 2008

Selenium: Xpath locator can not be used as Option Locator

In my new job been doing a lot of selenium and i needed to scroll through the list of
options in a select element and click on a particular options.

i have initially used the browser.DoubleClick

browser.DoubleClick("xpath=//select/option[child::text()='Option_Label']");)

But then this didnt work because selenium doesn't have the functionality to scroll down the select element in other to make my desired option visible.

Looking through the selenium api, i have used another method, which take in two parameters, the select locator and the option locator.

so i used:

browser.Select("xpath=//select", "xpath =//option[child::text()='Option_Label']");

that hasnt work either as the option locator type cannot be xpath. it has to be a label, id, atrribute, name or any other html locator

so i have done

browser.Select("xpath=//select", "label=Option_Label");

which in myown opinion i think is good as it is robust for a selenium test.