无法使用谷歌浏览器运行selenium

时间:2012-10-02 16:21:25

标签: selenium

1.启动selenium服务器:

sudo java -jar selenium-server-standalone-2.25.0.jar -trustAllSSLCertificates -port 4444 <br>
........
09:02:06.523 INFO - Version Jetty/5.1.x <br>
09:02:06.526 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver] <br>
09:02:06.533 INFO - Started HttpContext[/selenium-server,/selenium-server]<br>
09:02:06.537 INFO - Started HttpContext[/,/]<br>
09:02:06.571 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@7df17e77<br>
09:02:06.571 INFO - Started HttpContext[/wd,/wd]<br>
09:02:06.574 INFO - Started SocketListener on 0.0.0.0:4444<br>
09:02:06.577 INFO - Started org.openqa.jetty.jetty.Server@798fd984<br>

2. perl中的运行测试用例:

my $sel = Test::WWW::Selenium->new( host => "localhost", <br>
                                port => 4444, <br>
                                browser => "*googlechrome", <br>
                                browser_url => "http://>fns-IP/" );<br>

$sel->start;
$sel->open_ok("http://>fns-IP/login");

3.test log:

09:09:25.146 INFO - Command request: getNewBrowserSession[*googlechrome, http://>fns-IP/] on session null<br>
09:09:25.146 INFO - creating new remote session<br>
09:09:25.147 INFO - Allocated session 553a1b30a1dd4f8a889fa4dfb7a6ae8a for http://>fns-IP/, launching...<br>
09:09:25.147 INFO - Launching Google Chrome...<br>
09:09:30.336 INFO - Got result: OK,553a1b30a1dd4f8a889fa4dfb7a6ae8a on session 553a1b30a1dd4f8a889fa4dfb7a6ae8a<br>
09:09:30.340 INFO - Command request: open[http://>fns-IP/login, ] on session 553a1b30a1dd4f8a889fa4dfb7a6ae8a<br>
09:09:30.610 INFO - Got result: OK on session 553a1b30a1dd4f8a889fa4dfb7a6ae8a<br>
09:09:30.623 INFO - Command request: isElementPresent[id=id_username, ] on session 553a1b30a1dd4f8a889fa4dfb7a6ae8a<br>
09:09:32.393 INFO - Couldn't proxy to http://>qlriakmdkm/ because host not found<br>
09:09:32.395 INFO - Couldn't proxy to http://>wkdujqsymi/ because host not found<br>
09:09:32.393 INFO - Couldn't proxy to http://>rkjzjvpsbx/ because host not found<br>

4.网址在googlechrome浏览器中:

http://>fns-IP/selenium-server/core/RemoteRunner.html?sessionId=324f251e0de64cfeafa157de0c33ed41&multiWindow=true&baseUrl=http%3A%2F%2Ffns-4%2F&debugMode=false


http://>fns-IP/selenium-server/core/Blank.html?start=true

5.我在'ca.msn.com'网站上试过,效果很好。

感谢任何反馈。

在'http'中引用的所有网址中,字符'&gt;'为块引用添加。否则,它不允许我发布。 :(

1 个答案:

答案 0 :(得分:0)

我之前也遇到过这个问题但在我的情况下,trustAllSSLCertificates就足够了。 我建议你转向使用谷歌浏览器支持谷歌浏览器的selenium webdriver。