-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
form_with_fields versus _field_by_name (inconsistent results) #48
Comments
Hi Jess, the two XPath expressions are not the same: Passes:
Fails:
Some short code replicating the situation, or ideally, the actual, ideally self-contained HTML page (+JS) to reproduce the problem would help me diagnose this far better... |
Yup I see they arent, yet they both get used to find fields in a form.. We're trying to login to: https://www.amazon.co.uk/gp/yourstore/iyr/ref=pd_ys_iyr_edit_watched?ie=UTF8&collection=watched (which presents a signin page if not logged in) Code:
|
…get_attribute_future() This is rather invasive but fixes GH issue #48 by respecting the element subtree given as a reference, for example by ->current_form to restrict results to the current form.
Error reports with reproducible code are great!
v 0.42, now on CPAN should fix this problem. Thank you for providing code to reproduce the issue! |
Awesome, thanks! |
works! Did you intend to break: $mech->current_form()->get_attribute('outerHTML'); btw? it now prints HASH(0x...) instead of the HTML (we were just using it for debugging) |
Oops - no, that was not intended (and also not in the test suite ...)! Thanks for finding this and telling me, I'll release a fix soon! |
I'm attempting to load, then fill in, the amazon.co.uk signin page .. I get as far as "wait_until_visible" (the email input field is loaded by js.. why, who knows).. but then get stuck.
It seems the various xpath fetches don't all do the same things (is my guess):
form_with_fields('email','password') - this one works / no errors, selects the signIn form, as expected
_field_by_name(name => 'email', ..) as called by get_set_value (and ultimately from submit_form(with_fields => {email => '...'}); - this one doesnt, we get No elements found for input with name 'email'
xpath 1 (works):
//form[.//*[(local-name(.)="input" or local-name(.)="select" or local-name(.)="textarea") and @name="email"] and .//*[(local-name(.)="input" or local-name(.)="select" or local-name(.)="textarea") and @name="password"]]
xpath 2 (fails):
.//*[(local-name(.)="input" or local-name(.)="select" or local-name(.)="textarea") and @name="email"]
Any ideas?
The text was updated successfully, but these errors were encountered: