Get value by xPath knowing only the child of another node - selenium

Viewed 31

I have some problem. I have a few checkboxes but there are no id or name for tags. Structure looks like this:

enter image description here

I would like to get green value but I only know red value: name=onlyWebsite. But this is different node.

Ofcourse when I do: //input[@name='onlyWebsite']//i this doesn't work.

Could you help me?

1 Answers

to go to check from onlyWebsite, you may try the below xpath :

//input[@name='onlyWebsite']/following-sibling::span/descendant::i

if there are multiple span's as a following-sibling, you can try this :

//input[@name='onlyWebsite']/following-sibling::span[1]/descendant::i
Related