Difficulty with a locator(using java for selenium)

Issue

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

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

Answered By – KunduK

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published