Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Difficulty with a locator(using java for selenium)

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" class="_908LZ _1pO2V m29-z _4R7G3 _2JFg2" aria-disabled="false" aria-label="Приемане на всички бисквитки" data-qa="privacy-settings-action-info">OK</button>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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']")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading