Reputation: 261
I am trying to find the input type with statusid_103408 and with text() Draft
here is the xpath i am using, not sure where I am going wrong
//input[@name='statusid_103408' and contains(text(), 'Draft')]
Upvotes: 0
Views: 50
Reputation: 406
The reason this xpath does not work is because the text of "Draft" is not actually a property of the input element. It is contained in the li element that is the parent. Therefore, your search is returning no results.
I suggest just using the name only in your xpath search (if it unique). If you definitely need the text in your search, you can search the li item's text first, then find your input, like so:
//li[text()='Draft']/input[@name='statusid_103408']
Upvotes: 1
Reputation: 306
Use Value it will work , because value is unique, text is not inside the input tag!
Upvotes: 1