Selenium server does not open browser

I'm trying to get our tried and tested Behat setup to work, but even though Selenium server is up and running, the browser window never opens when I run my script. It seems to be running headless (which it's not supposed to do) but when I check my output file then none of the steps have passed.

I've tried deleting everything and starting from scratch with a fresh pull, but nothing does the trick. Unfortunately I have no idea how I'm supposed to troubleshoot this particular problem so it seems like you guys are my last hope.

I'm guessing my setup would not be of much value since it's already working across multiple other machines but maybe someone has experienced a similar problem and might have a suggestion as to what the error might be. If you need anymore information then please let me know and I'll be happy to provide it.

I use the following when I start Selenium Server:

selenium-server-standalone-2.9.0.jar

chromedriver-2.24

InternetExplorerDriver server (64-bit) 2.53.1.0

Powershell script that I use to start Selenium Server:

Param (
      [string] $FireFoxBinary  
      )
$SeleniumServerPath = (Split-Path -Parent $MyInvocation.MyCommand.Definition) 
if (-not ([String]::IsNullOrEmpty($FireFoxBinary))) {
    $WebDriverFireFoxBin ="""-Dwebdriver.firefox.bin=$FireFoxBinary"""
}
java -jar (Join-Path $SeleniumServerPath "selenium-server-standalone-2.9.0.jar")  "-Dwebdriver.ie.driver=$(Join-Path $SeleniumServerPath IEDriverServer.exe)" "-Dwebdriver.chrome.driver=$(Join-Path $SeleniumServerPath chromedriver-2.24.exe)" $WebDriverFireFoxBin

Console output when starting Selenium server:

INFO: Launching a standalone server Setting system property webdriver.ie.driver to D:Datagit_stuffebiz-test-automationFrameworkSelenium_serverselenium_2.9.0IEDriverServer.exe Setting system property webdriver.chrome.driver to D:Datagit_stuffebiz-test-automationFrameworkSelenium_serverselenium_2.9.0chromedriver-2.24.exe 14:16:09.054 INFO - Java: Oracle Corporation 25.121-b13 14:16:09.070 INFO - OS: Windows 7 6.1 amd64 14:16:09.070 INFO - v2.9.0, with Core v2.9.0. Built from revision 14289 14:16:09.210 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub 14:16:09.210 INFO - Version Jetty/5.1.x 14:16:09.210 INFO - Started HttpContext[/selenium-server,/selenium-server] 14:16:09.382 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@7d4793a8 14:16:09.382 INFO - Started HttpContext[/wd,/wd] 14:16:09.382 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver] 14:16:09.382 INFO - Started HttpContext[/,/] 14:16:09.398 INFO - Started SocketListener on 0.0.0.0:4444 14:16:09.398 INFO - Started org.openqa.jetty.jetty.Server@5b6f7412


One thing that helps a lot of people who've encountered your sort of problem is maximizing the browser. Even a headless browser needs room to render. I just use:

driver.manage().window().maximize();

You should also try to take a screenshot immediately after the first driver.get().


Not a very good setup for starting selenium server in my opinion.

You should keep in mind that with browser update the old selenium might not work as expected.

If you want to keep the same structure you should also add the path to the new selenium server.

Try running with firefox, get the latest selenium server 3.1.0 and the latest chromedriver 2.27 and start selenium without the script to test it.

Download both (driver+selenium) in the same directory, open a console and run something like this,

for windows:
java -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server-standalone-3.1.0.jar

for mac:
java -Dwebdrive.chrome.driver=chromedriver -jar selenium-server-standalone-3.1.0.jar

链接地址: http://www.djcxy.com/p/50690.html

上一篇: 在javascript / jquery中获取URL数组变量

下一篇: Selenium服务器不打开浏览器