I've tried the following xpath but none of them work. The id is listed differently everytime. Next to the checkbox is this word " poetin alfa"
- //input[@type='checkbox'][@value='on']
- //*[@id='id1']
-//input[contains(text(),'<poetin alfa>')]/preceding-sibling::input[@type='checkbox']
- //input[contains(text(),'<poetin alfa>')]/following-sibling::input[@type='checkbox']
<span class="v-checkbox v-widget">
<input id="id1" type="checkbox" value="on" tabindex="0"/>
<label for="id1"/>
asked Jul 3, 2018 at 21:12
1 Answer 1
Try with the below xpath.
//input[contains(text(),'poetin alfa')]/preceding-sibling::input[@type='checkbox']
As you didnt provide the html structure of the text (poetin alfa), I will go with your xpath. The xpath which you constructed has <>.
//input[contains(text(),'')]
You should remove the <> in contains text().
answered Jul 4, 2018 at 9:10
default
<poetin alfa>
are an other checkbox value ? Another tag with "poaetin alpha" as text ? In your XPath example, you seem to be looking for a tag into a text of another tag. Please provide full example of your HTML which containing thepoetin alfa
tag, it will be easier to help you<label for="id1">poetin alfa</label>
or if it really does have ankle brackets<label for="id1"><poetin alfa></label>