I am currently learning page object model (POM) and I am trying to access a specific web element using @FindBy but I am not sure how to correctly write the syntax for my element into @FindBy?

What I have is:


So my question is how do I place a[da-qid='inventory'] correctly into @FindBy?


By, a[da-qid='inventory'], what I mean is that it selects every <a> element whose da-qid value begins with 'inventory'.

3 Answers 3


I've used that kind of locators in my last project and it's worked like charm. I hope this is that You want :)

  • Awesome, thanks! This is what I was look for.
    – Robben
    Commented Jul 23, 2015 at 20:31

I can't give you an exact answer without seeing the full element, but the official documentation on selectors ought to help you out.

  • I have made an edit to my question. Does my edit help clarify?
    – Robben
    Commented Jul 23, 2015 at 20:04
  • For "begins with", there is a special selector. Check out this article and scroll down to the advanced section. saucelabs.com/resources/selenium/css-selectors
    – kirbycope
    Commented Jul 23, 2015 at 20:22

This syntax might help u check out. @FindBy(locator="locator value") private WebElement elementName; Don't forget in POM we follow encapsulation concept

  • Hi @Anand welcome to SQA, We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed. Commented Jul 27, 2015 at 4:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.