Selenium checkbox input’s versus XPath, it’s easy as: //input[@id=(//label[text()=”pie”]/@for)]
Monday, October 9th, 2006Using Selenium and Xpath, what is the easiest way to select the checkbox below if I don’t know what the id will be?
Source:
<input id="foo" type="checkbox"/><label for="foo">pie</label>
So far, I’ve come up with this:
id(//label[text()='pie']/@for)[@type='checkbox']
It still doesn’t necessarily find the <input> tag, but it’s close enough for most purposes, comments?