in reply to Re^2: W-M-F and event.keyCode===keys.ENTER
in thread W-M-F and event.keyCode===keys.ENTER

Note that WWW::Mechanize::Firefox already sends focus and blur events if you use the ->field() method to set the value.

Replies are listed 'Best First'.
Re^4: W-M-F and event.keyCode===keys.ENTER
by pghilb (Novice) on Jul 27, 2014 at 10:18 UTC

    Noted gratefully. I was trying to identify my input within a form, naturally, but it turned out to be difficult (the authors of the webpage seem to be a bit paranoid, anyway), that's why I was working on something else.

    Maybe a new method

    ...->set_nasty_value
    in W-M-F doing 'focus' and 'blur' on a node would be helpful on such occassions for the users of W-M-F.

      I'm not sure why ->set_nasty_value would be sp special, but I can see that adding a modification of ->field() which does take a plain DOM node instead of a field name would be convenient. The routine would reduce to

      sub set_nasty_value { my( $self, $dom_node, $value )= @_; $self->get_set_value( name => $dom_node, value => $value ) }

      ... so maybe just call it that way directly.

      I think I should document that part of ->get_set_value a bit better.

        Thanks a lot for all your comments, Corion.

        Now everything must be learned hard way, however good are tools at one's disposal, unlike the blessed times when reading a just few pages on WWW::Mechanize opened the whole world for you almost immediately.

        Necessary documentation in hand, the only way now is to automate as many pages as possible, starting with relatively simple ones.