加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

使用WWW :: Mechanize模块在Perl中填写表单

发布时间:2020-12-15 23:24:00 所属栏目:大数据 来源:网络整理
导读:我正在创建一个脚本,使用mechanize模块在Perl中登录到Web表单,我收到错误: syntax error at /home/arty/scripts/gmail_pw_chngr.pl line 18,near “button” Execution of /home/arty/scripts/gmail_pw_chngr.pl aborted due to compilation errors. 码 use
我正在创建一个脚本,使用mechanize模块在Perl中登录到Web表单,我收到错误:

syntax error at /home/arty/scripts/gmail_pw_chngr.pl line 18,near “button”
Execution of /home/arty/scripts/gmail_pw_chngr.pl aborted due to compilation errors.

use WWW::Mechanize;
    my $mech = WWW::Mechanize->new();

    my $url = "https://accounts.google.com/Login";

    $mech->get($url);

    $result = $mech->submit_form(
        form_name => 'gaia_loginform',# Name of the form
        #Instead of form name you can specify
        #form_number => 1
        fields       =>
        {
            Email  => 'arty32l@gmail.com',# Name of the input field and value
            Passwd => 'password',}
        button    => 'signIn' # Name of the submit button
    );
    print $result->content();

上面是代码,输入中的所有值都是名称,但它始终在同一行上出错.

解决方法

有问题的错误是按钮前缺少逗号.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读