【发布时间】:2011-02-18 01:09:19
【问题描述】:
我有一个 Perl 脚本,它使用 Selenium 来获取一个名为 foo 的 HTML 文档,该文档不存在(404 未找到。)脚本的默认行为是打印错误并终止,这样“bar”永远不会打印。我正在寻找一种让它继续运行的方法,例如打印“bar”。
这就是我所拥有的。代码(称为 foo.pl):
#!/usr/bin/perl
use strict;
use WWW::Selenium;
my $sel = WWW::Selenium->new( host => "localhost",
port => 4444,
browser => "*chrome",
browser_url => "http://www.google.com/" );
$sel->start;
$sel->open("http://www.google.com/foo.html")
print "bar";
这是打印出来的信息:
Error requesting http://localhost:4444/selenium-server/driver/?cmd=open&1=http%3A%2F%2Fwww.google.com%2Ffoo.html&sessionId=bc9c086eef804a7c8a0090674333e4c7:
XHR ERROR: URL = http://www.google.com/foo.html Response_Code = 404 Error_Message = Not Found
我已经看遍了,但还没有找到答案。谢谢!
【问题讨论】: