[英]WWW::Mechanize::Firefox and MozRepl
I wrote some code with help from examples but when I run it I'm getting error in Ubuntu Server 12.04.2 LTS: 我在示例的帮助下编写了一些代码,但是当我运行它时,我在Ubuntu Server 12.04.2 LTS中遇到错误:
Failed to connect to , problem connecting to "localhost", port 4242: Connection refused at /usr/local/share/perl/5.14.2/MozRepl/Client.pm line 144
How can i fix this ? 我怎样才能解决这个问题 ?
#!/usr/bin/perl -w
use strict;
use WWW::Mechanize::Firefox;
use HTTP::Cookies;
my $username = "test";
my $password = "t3st";
my $mech = WWW::Mechanize::Firefox->new();
$mech->get("http://test.com/login.php"); print "Logging, Please Wait.\n";
$mech->submit_form(
form_number => 0,
fields => {
username => "$username",
password => "$password",
}
);
Once installed, start the MozRepl in your firefox as below: 安装完成后,如下所示在您的Firefox中启动MozRepl:
Tools->MozRepl->Start 工具 - > MozRepl->启动
Confirm that MozRepl is listening on port 4242 as below: 确认MozRepl正在侦听端口4242,如下所示:
tcp 0 0 127.0.0.1:4242 0.0.0.0:* LISTEN 1438/firefox tcp 0 0 127.0.0.1:4242 0.0.0.0:* LISTEN 1438 / firefox
Good Luck !! 祝好运 !!
Note : I am not able to format this answer properly as SO formatting is not working as expected. 注意 :由于SO格式无法正常工作,因此我无法正确设置此答案的格式。
重要的是,在上述答案中添加重要的一点是,从版本18开始,Firefox不再显示“工具”菜单,除非您键入F10键或选择“选项->菜单栏”。
您是否已为端口4242安装并启用并配置了mozrepl插件?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.