This will be a quick post, but I wanted to share a little tip. When using the Selenium IDE you often get xpath that looks similar to this.
browser.click "//div[@id='location-bar']/div[2]/div[4]/a"
Well when attempting to do cross-browser testing this Xpath may not work for all browsers and relying on an index value that may change is a bit brittle.
One way to adjust this Xpath would be to make it look like this.
browser.click "//div[@id='location-bar']/div[@class='this']/div[@class='that']/a"
Of course everything is dependent on how the object on the page is represented. Inspect the HTML closely.
Here are another helpful hints on clicking links.
browser.click "//a[contains(@href,'stuff')]"
or
browser.click "//a[contains(text(),'otherstuff')]"
I hope you find these pointers helpful.
Happy coding!
No comments:
Post a Comment