简体   繁体   English

如何使用WWW :: Mechanize按下没有名称属性的按钮?

[英]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. 我正在使用WWW::Mechanize模块。 I tried $agent->submit(); 我尝试了$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 : 无需显式单击按钮即可提交表单,而让Mechanize隐式处理

$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 . 运行mech-dump以查看相关的表单输入字段名称,例如在我的示例usernamepassword

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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