0 votes
in Xpath Interview Questions by
Can you write xpath for aria labels?

1 Answer

0 votes
by

You can write xpath for any attribute present in the HTML tag; aria-label has been used to help visually impaired people. We can write xpath to aria labels as if it is an ID or a class.

<button aria-label="Close" onclick="myDialog.close()">X</button>

Xpath :  //button[@aria-label='Close']

Related questions

0 votes
asked Jul 26, 2021 in Xpath Interview Questions by SakshiSharma
0 votes
asked Jul 24, 2021 in Xpath Interview Questions by Robindeniel
...