Home > database >  How to find XPath for the input field
How to find XPath for the input field

Time:07-29

HTML:

<div ><div ><div ><input id="input-357" type="text"></div></div><div ><div 

I tried this:

//*[text()='Enter Phone Number']/following-sibling::*//input  

But got no success.

CodePudding user response:

you are missing the tagname xpath = //tagname[@attribute='value']

CodePudding user response:

While constructing an xpath, the expression need to start with a tag_name e.g. <div>, <table> etc or a * and always preceded by a double frontslash i.e. //


Solution

Effectively, your line of code will be:

//*[text()='Enter Phone Number']//following-sibling::input[1]
  • Related