Selenium Object Locator

Home Forums Software Testing Discussions Selenium Object Locator

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #19175

    How often and when do you like to use XPath?
    I was always advised to give least importance to XPath (structure based locator)


    Not very often, but I don’t hesitate to use it where it suits me. Years ago people talked about XPath performance problems, in the same time in my tests I found that CSS pseudo-classes do not work for me in some browsers. A few years ago one guy posting to automation community tested performance of the two types and his conclusion was that XPath performance is as good as CSS selectors (providing both are built reasonably). Support of CSS pseudo-classes also developed.

    So — use whatever suits you, the most important thing IMO is that your locators look reasonable and are bound to some well-marking attribute, not just to the structure.


    @rpwheeler, thanks for your comment. Yes, I understood that as long as our locators are reliable we are good to go with whatever that suits our purpose.
    Also to start with an ‘anchor’ which is not likely to change is one of the best practice I follow.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Learn Exploratory TestingYou Don't want to Miss this Event

Learn the basics of Exploratory Testing in this insightful session