Svante
Svante

Reputation: 1069

ChromeDriver blocks and does not fail after unexpected Alert box

I am running selenium-server-standalone-2.17.0 (for IE and Firefox) and ChromeDriver 18.0.1022.0 (standalone) on a test box (Windows 7 64bit) which I use to run Java selenium tests against.

For some reason, when running my tests against ChromeDriver, the first time it encounters an unexpected Alert box, it blocks idefinitely and the ChromeDriver log says

WARNING: Executing: executeScript

I configured ChromeDriver using the guide http://code.google.com/p/selenium/wiki/ChromeDriver and set the timeout of all the drivers with

webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);

Update: I figured out how to initialize the remote ChromeDriver in a clean way with

URL url = new URL("http://192.168.1.15:4444/wd/hub"); 
DesiredCapabilities capabilities = DesiredCapabilities.chrome(); 
Webdriver chromeDriver = new RemoteWebDriver(url, capabilities); 

this ran best with the URL pointing to a selenium-server running chromedriver in a child process. You can make selenium-server run the ChromeDriver by starting it like this:

java -jar C:\selenium-server.jar -Dwebdriver.chrome.driver=C:\path\to\chromedriver.exe

I still have the same problem with Chrome getting stuck at the unexpected Alert box, but the selenium log gave me at bit more info:

INFO - Done: /session/1328623219287/element/253/click
INFO - Executing: [execute script: return !!document['readyState'];, []] at URL: /session/1328623219287/execute)

Still have no idea what is causing this... can anyone help?

Upvotes: 0

Views: 1328

Answers (1)

Pavel Janicek
Pavel Janicek

Reputation: 14738

This is how I initialize ChromeDriver:

System.setProperty(ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY, 
"PathToWhereChromeDriverIsAvailable"); 
ChromeDriverService service = ChromeDriverService.createDefaultService(); 
ChromeOptions options = new ChromeOptions(); 
options.addArguments("--start-maximized"); 
ChromeDriver cd = new ChromeDriver(service, options);

With the Alert() i have just plain guess - probably it hangs out while executing the script - so basically you are not waiting for page to load, but for script to end executing. However, I do not have solution for this...

Upvotes: 1

Related Questions