0 votes
in Xpath Interview Questions by
Write XPath for a Button?

1 Answer

0 votes
by
Here, some people ask without giving any instruction for the questions. You have to ask the question of whether you should consider the button source code on your own.

You should know to create a button; otherwise, the intention of the question will not be satisfied. You can form the button in two ways, either using the button tag or input tag.

Xpath for button

// form button using input tag

<input type='button' value='ABCD'>

Xpath : //input[@type='button']

// form button using the button tag

<button>XYZ</button>

Xpath : //button​

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
...