You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Watir Version: 7.3.0
Selenium Version: 4.26.0
Browser Version: Firefox 128.3.1esr (64-bit)
Browser Driver Version: Whatever selenium-webdriver installed (how would I discover that?)
OS Version: Debian Bookworm(ish)
Expected Behavior -
I've got a page whose form inputs are structured like this:
<label>
<span>
<input type="text">
</span>
<span><!-- yes it puts an empty span in here... --></span>
<span>
The Text
</span>
</label>
I'd like for browser.text_field(label: "The Text") to find the associated input.
Actual Behavior -
It... doesn't do that.
Steps to reproduce -
See above.
Commentary
As far as I can tell, this is allowed by the HTML5 spec, as unwise as that may be, but basically no example of using inputs nested in labels has extra elements in the way, so it's not unreasonable that it isn't currently supported in Watir. It looks like the matching of inputs inside labels was implemented in #200, but if I'm understanding the XPath correctly, it's only looking for the label as a direct parent, and probably that needs to be changed to use ancestor::label (if that's a thing? I dunno, XPath scares me).
The text was updated successfully, but these errors were encountered:
Meta -
Watir Version: 7.3.0
Selenium Version: 4.26.0
Browser Version: Firefox 128.3.1esr (64-bit)
Browser Driver Version: Whatever selenium-webdriver installed (how would I discover that?)
OS Version: Debian Bookworm(ish)
Expected Behavior -
I've got a page whose form inputs are structured like this:
I'd like for
browser.text_field(label: "The Text")
to find the associated input.Actual Behavior -
It... doesn't do that.
Steps to reproduce -
See above.
Commentary
As far as I can tell, this is allowed by the HTML5 spec, as unwise as that may be, but basically no example of using inputs nested in labels has extra elements in the way, so it's not unreasonable that it isn't currently supported in Watir. It looks like the matching of inputs inside labels was implemented in #200, but if I'm understanding the XPath correctly, it's only looking for the label as a direct parent, and probably that needs to be changed to use
ancestor::label
(if that's a thing? I dunno, XPath scares me).The text was updated successfully, but these errors were encountered: