I have seen some examples of how to do this in Javascript or python, but am looking for how to find the text of the for attribute on a label. e.g.
<label for="thisIsTheTextNeeded">LabelText</label>
<input type="checkbox" id=thisIsTheTextNeeded">
We want to pick up the text from the for attribute on the label element. Then use that text as the id to find the checkbox.
The .NET solution might look like:
textWeNeed = selenium.getAttribute("//label[text()='LabelText']/@for");
I tried this in Ruby:
textWeNeed =
@browser.find_element("xpath//label[text()='LabelText']/@for")
and get the error:
expected "xpath//label[text()=input_value]/@for":String to respond to #shift (ArgumentError)
Any ideas?