Perl 脚本无法通过 Eclipse 中的 EPIC 插件运行
Perl script not working through EPIC plug in in Eclipse
我的 eclipse 中有以下 Perl 脚本:
#!/usr/bin/perl
use Selenium::Remote::Driver;
print "Hello, World!\n";
my $name = "king";
print "Hello, $name!\n";
my $driver = new Selenium::Remote::Driver('browser_name' => 'firefox');
$driver->get('http://www.google.com');
print $driver->get_title();
$driver->quit();
输出:
Hello, World!
Hello, king!
Selenium server did not return proper status at (eval 91) line 64.
为什么我收到错误消息:
"Selenium server did not return proper status at (eval 91) line 64"
浏览器没有启动。如果有人知道解决方案,请提供帮助。
您的代码看起来是正确的。在 shebang
之后的顶部添加 use strict; use warnings;
并确保 selenium 独立服务器是 运行.
所以步骤是
- 运行 硒服务器:
java -jar selenium-server-standalone-2.44.0.jar
观察下面的输出
➤ java -jar selenium-server-standalone-2.44.0.jar
15:18:56.677 INFO - Launching a standalone server
15:18:56.900 INFO - Java: Oracle Corporation 25.40-b25
15:18:56.900 INFO - OS: Windows 7 6.1 x86
15:18:56.914 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
15:18:57.174 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
15:18:57.175 INFO - Version Jetty/5.1.x
15:18:57.176 INFO - Started HttpContext[/selenium-server,/selenium-server]
15:18:57.325 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@af7cc2
15:18:57.325 INFO - Started HttpContext[/wd,/wd]
15:18:57.325 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
15:18:57.325 INFO - Started HttpContext[/,/]
15:18:57.329 INFO - Started SocketListener on 0.0.0.0:4444
15:18:57.329 INFO - Started org.openqa.jetty.jetty.Server@133314b
- 运行 你的脚本。
我在 selenium-server-standalone-2.44.0 和 firefox 33.0 上测试了这个。它运作良好。
更新: 根据提到的错误 here 您必须使用 Selenium 2.42 或更高版本。
我的 eclipse 中有以下 Perl 脚本:
#!/usr/bin/perl
use Selenium::Remote::Driver;
print "Hello, World!\n";
my $name = "king";
print "Hello, $name!\n";
my $driver = new Selenium::Remote::Driver('browser_name' => 'firefox');
$driver->get('http://www.google.com');
print $driver->get_title();
$driver->quit();
输出:
Hello, World!
Hello, king!
Selenium server did not return proper status at (eval 91) line 64.
为什么我收到错误消息:
"Selenium server did not return proper status at (eval 91) line 64"
浏览器没有启动。如果有人知道解决方案,请提供帮助。
您的代码看起来是正确的。在 shebang
之后的顶部添加 use strict; use warnings;
并确保 selenium 独立服务器是 运行.
所以步骤是
- 运行 硒服务器:
java -jar selenium-server-standalone-2.44.0.jar
观察下面的输出
➤ java -jar selenium-server-standalone-2.44.0.jar
15:18:56.677 INFO - Launching a standalone server
15:18:56.900 INFO - Java: Oracle Corporation 25.40-b25
15:18:56.900 INFO - OS: Windows 7 6.1 x86
15:18:56.914 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
15:18:57.174 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
15:18:57.175 INFO - Version Jetty/5.1.x
15:18:57.176 INFO - Started HttpContext[/selenium-server,/selenium-server]
15:18:57.325 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@af7cc2
15:18:57.325 INFO - Started HttpContext[/wd,/wd]
15:18:57.325 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
15:18:57.325 INFO - Started HttpContext[/,/]
15:18:57.329 INFO - Started SocketListener on 0.0.0.0:4444
15:18:57.329 INFO - Started org.openqa.jetty.jetty.Server@133314b
- 运行 你的脚本。
我在 selenium-server-standalone-2.44.0 和 firefox 33.0 上测试了这个。它运作良好。
更新: 根据提到的错误 here 您必须使用 Selenium 2.42 或更高版本。