我的perl脚本无法连接到localhost端口4444中运行的selenium独立服务器。在不同的环境中会发生不同的事情。
Windows 7:脚本有时会运行,有时也不会运行。
Selenium服务器端:正常启动。但是在创建远程驱动程序实例时没有创建新会话。
C:\Users\ganess4\msant\nsn_testeng\tools\AutoBuildPromotionEmail>java -jar selenium-server-standalone-2.37.0.jar
Dec 3, 2013 12:16:43 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
12:16:43.882 INFO - Java: Sun Microsystems Inc. 20.14-b01
12:16:43.882 INFO - OS: Windows 7 6.1 x86
12:16:43.894 INFO - v2.37.0, with Core v2.37.0. Built from revision a7c61cb
12:16:43.953 INFO - Default driver org.openqa.selenium.iphone.IPhoneDriver regis
tration is skipped: registration capabilities Capabilities [{platform=MAC, brows
erName=iPhone, version=}] does not match with current platform: VISTA
12:16:43.973 INFO - Default driver org.openqa.selenium.iphone.IPhoneDriver regis
tration is skipped: registration capabilities Capabilities [{platform=MAC, brows
erName=iPad, version=}] does not match with current platform: VISTA
12:16:44.020 INFO - RemoteWebDriver instances should connect to: http://127.0.0.
1:4444/wd/hub
12:16:44.021 INFO - Version Jetty/5.1.x
12:16:44.022 INFO - Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
12:16:44.023 INFO - Started HttpContext[/selenium-server,/selenium-server]
12:16:44.024 INFO - Started HttpContext[/,/]
12:16:44.074 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@1754ad
2
12:16:44.074 INFO - Started HttpContext[/wd,/wd]
12:16:44.112 INFO - Started SocketListener on 0.0.0.0:4444
12:16:44.112 INFO - Started org.openqa.jetty.jetty.Server@c1b531
代码方:注意我确实尝试了端口4444和其他变体。
my $browser = "firefox";
my $platform = "WINDOWS";
eval
{
$self->{seldriverarray} = new Selenium::Remote::Driver(browser_name => $browser, platform => $platform);
$self->{seldriverarray}->debug_on;
print Dumper $self->{seldriverarray}->status;
};
抛出以下内容
Use of uninitialized value in string ne at C:/Dwimperl/perl/site/lib/Selenium/Re
mote/RemoteConnection.pm line 30, <FH> line 48.
Use of uninitialized value in string eq at C:/Dwimperl/perl/site/lib/Selenium/Re
mote/RemoteConnection.pm line 35, <FH> line 48.
Selenium server did not return proper status at C:/Dwimperl/perl/site/lib/Seleni
um/Remote/Driver.pm line 232.
当我在另一个环境中运行时,最奇怪的事情发生了 Suse Enterprise Edition:
Selenium服务器端:看到它创建一个新会话,这意味着代码没有错。那么,什么阻止代码在Windows中启动新会话?我无法在linux中运行该脚本,因为它很长时间都在努力推出firefox。
12:32:09.969 INFO - Started org.openqa.jetty.jetty.Server@181edf4
12:32:19.041 INFO - Executing: [new session: {platform=WINDOWS, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, version=}] at URL: /session)
12:32:19.057 INFO - Creating a new session for Capabilities [{platform=WINDOWS, javascriptEnabled=true, acceptSslCerts=true, browserName=firefox, version=}]
答案 0 :(得分:0)
更新Net :: HTTPS和IO :: Socket :: SSL后,这个问题得到了解决。