Priority of Locators when recording Tests with Selenium IDE

741 views
Skip to first unread message

Julian C

unread,
Jun 30, 2011, 5:53:30 AM6/30/11
to Selenium Users

Hi folks,

im interested in the exact Priority the Selenium IDE will try to
determine the Element-Locator when recording Tests.
I guess its something like this:

1. id-Locator
2. name-Locator
3. css-Locator
4. link-Locator
5. xpath-Locator

I need this data to do a little internal review for my company.
Thanks for your help in advance.

JC

Ross Patterson

unread,
Jun 30, 2011, 8:23:44 AM6/30/11
to seleniu...@googlegroups.com

I think the priority-order has varied over time, but you can easily find it out for the version of Selenium IDE that you're using.  It's explicitly set in the last line of locatorBuilders.js, which currently reads:

 

LocatorBuilders.order = ['ui', 'id', 'link', 'name', 'css', 'dom:name', 'xpath:link', 'xpath:img', 'xpath:attributes', 'xpath:idRelative', 'xpath:href', 'dom:index', 'xpath:position'];

 

The reason it's done this way is explained by the comment immediately above that line:

 

// You can change the priority of builders by setting LocatorBuilders.order.

 

Ross

Julian C

unread,
Jun 30, 2011, 9:45:22 AM6/30/11
to Selenium Users

Thank you very much, you helped me a lot.
Reply all
Reply to author
Forward
0 new messages