Home > OS >  How to write following sibling CSS/Xpath expression of username field?
How to write following sibling CSS/Xpath expression of username field?

Time:04-21

HTML Code:

<form autocomplete="on" xpath="1">
  <div >
     <input   autocomplete="off" type="text" value="">
     <span ></span>

I can write this one : //input[@type='text']

enter image description here

But how to write it in "following sibling" CSS/xpath of the above code?

CodePudding user response:

If you want to fetch input node based on its sibling, try:

//label[.='Enter Email/Mobile number']/preceding-sibling::input
  • Related