简体   繁体   中英

How do I press a button with no name attribute with WWW::Mechanize?

This is the button I want to click:

<input type="submit" value="Continue">

As you see it has no name at all to specify the order on it. I am using the WWW::Mechanize module. I tried $agent->submit(); , but it seems to not do the job, any help please?

It is not necessary to explicitely click the button to submit a form, let Mechanize handle it implicitly :

$mech->submit_form(
    with_fields => {
        username => 'foobar',
        password => '12345678',
    }
);

Run mech-dump to see the relevant form input field names, for instance here in my example username and password .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM