| || |
New to Selenium: Not able to click the link by ID
I am new to selenium but very old to QTP.
I just did a search on Yahoo.com with the string "selenium IDE" and am trying to click on the link of the first result.
Tried with below lines
selenium.click("id=yui_3_3_0_1_1371051485613123"); (getting object details from xpath checker)
what is best way to recognize objects like this whose id's are not unique or object that don't get recognized.
thanks in advance!
You might want to switch to selenium builder, https://saucelabs.com/builder. I was just at the selenium conference and they pretty much plan on killing off selenium IDE and RC. For record and playback, selenium builder is preferred, and for programming bindings, webdriver will be preferred. With selenium 3, RC will be completely deprecated. Anyone using IDE and RC were basically made fun off at the conference.
As for how to recognize objects.. here are order in preference..
1) Name (for form elements)
3) Tag (but rarely are tags unique, but if it is, use it since look ups for these are much quicker than the below methods)
4) Classname / CSS Selector (This selector is problematic for IE9 and earlier, but is preferred because it has much better performance and better maintainability than xpath)
5) XPath (sort of your last ditch effort, usually used for things that are deeply nested and hard to select)