Setting form fields does not seem to send pre and post events
davavra opened this issue · comments
$mech->set_fields calls $mech->do_set_fields which in turn calls $mech->get_set_value.
$mech->get_set_value doesn't seem to send the pre and post events. In fact, there are only comments saying they will be sent.
I need to send an "input" event for these and after the form is filled send an "ngSubmit" event to the form.
I could do this with WWW::Mechanize::Firefox but the ability to send events in the code seems to have vanished.
Was this intentional?
It's a login page. I'd rather not reveal it or the content to the public. Can I PM it to you?
This is more for my lazyness with writing the tests myself and making sure my fix works for you. I've just pushed d53242f , which could maybe be the fix you need already.
If this works for you, I'll add a test and release it onto CPAN.
If it doesn't work, you can reach me at corion@corion.net
to send me the URL of the failing page so I can take a closer look.
It works. At least sent the post 'input" event to the field. I didn't really test the pre-events but the code likely works as it is the same as the post-events.
Thanks
Update:
if no pre or post values are given, the code creates pre=[ undef ] and post=[ undef] resulting in sending events "". $self->{pre_value} and $self->{post_value} were defined in WWW::Mechanize::Firefox but not WWW::Mechanize::Chrome.
Oh, that's a good spot! I'll fix that, thank you!
Looks great. I'll leave it to you to close the issue
Released as 0.47