Home > Software design >  Difficulty with a locator(using java for selenium)
Difficulty with a locator(using java for selenium)

Time:06-30

Complete newbie here...started trying to learn selenium with java this month. Having troubles locating one button, because it seems to lack name id, link and its class is weird looking. Can someone help me write a locator for it? Its an accept cookies button.

<button type="button"  aria-disabled="false" aria-label="Приемане на всички бисквитки" data-qa="privacy-settings-action-info">OK</button>

CodePudding user response:

You can use either of the xpath option to identify the element.

By.xpath("//button[text()='OK']")

OR

By.xpath("//button[@data-qa='privacy-settings-action-info']")
  • Related