SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.22k stars 8.11k forks source link

Selenium 3.5.2 does not work with ChromeDriver #4550

Closed mgruner closed 7 years ago

mgruner commented 7 years ago

Meta -

OS: Mac OS 10.11.6 (15G1611), also occurs on Linux Selenium Version: 3.5.2 Browser: Chrome, Chromium

Expected Behavior -

Works correctly in 3.4.0: java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /usr/local/opt/selenium-server-standalone/libexec/selenium-server-standalone-3.4.0.jar Tests run correctly with Chrome/Chromium on MacOS and on Linux.

If I provide a wrong path via -Dwebdriver.chrome.driver, there is a meaningful exception (WARN - Exception: The driver executable does not exist: ...)

Actual Behavior -

Seems to be broken in 3.5.2: java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /Users/martin/Downloads/selenium-server-standalone-3.5.2.jar

This starts selenium, but any attempts to create a session will fail without a meaningful error message. Further more, providing a wrong value to -Dwebdriver.chrome.driver leads to the same behaviour, instead of a correct error message. Here are the last log entries in the Selenium log, it seems to end suddenly:

java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /Users/martin/Dowoads/selenium-server-standalone-3.5.2.jar 
11:58:28.691 INFO - Selenium build info: version: '3.5.2', revision: '10229a9020'
11:58:28.691 INFO - Launching a standalone Selenium Server
2017-08-23 11:58:28.711:INFO::main: Logging initialized @226ms to org.seleniumhq.jetty9.util.log.StdErrLog
11:58:28.759 INFO - Driver class not found: com.opera.core.systems.OperaDriver
11:58:28.783 INFO - Driver provider class org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
 registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC
11:58:28.783 INFO - Driver provider class org.openqa.selenium.edge.EdgeDriver registration is skipped:
 registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC
11:58:28.811 INFO - Using the passthrough mode handler
2017-08-23 11:58:28.832:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2017-08-23 11:58:28.856:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@1f28c152{/,null,STARTING} has uncovered http methods for path: /
2017-08-23 11:58:28.861:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@1f28c152{/,null,AVAILABLE}
2017-08-23 11:58:28.886:INFO:osjs.AbstractConnector:main: Started ServerConnector@1e6d1014{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-08-23 11:58:28.887:INFO:osjs.Server:main: Started @402ms
11:58:28.887 INFO - Selenium Server is up and running
2017-08-23 11:58:32.550:INFO:osjshC.ROOT:qtp864237698-11: org.openqa.selenium.remote.server.WebDriverServlet-3532ec19: Initialising WebDriverServlet
11:58:32.573 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.Status@4479442d
11:58:32.577 INFO - /status: Executing GET on /status (handler: Status)
11:58:32.618 INFO - Binding default provider to: org.openqa.selenium.chrome.ChromeDriverService
11:58:32.619 INFO - Found handler: org.openqa.selenium.remote.server.BeginSession@569a7793
11:58:32.619 INFO - /session: Executing POST on /session (handler: BeginSession)
11:58:32.636 INFO - Capabilities are: Capabilities {acceptSslCerts=true, marionette=false, browserName=chrome, javascriptEnabled=true, chromeOptions={args=[disable-infobars]}, platformName=ANY, version=, platform=ANY, }
11:58:32.637 INFO - Capabilities {acceptSslCerts=true, marionette=false, browserName=chrome, javascriptEnabled=true, chromeOptions={args=[disable-infobars]}, platformName=ANY, version=, platform=ANY, } matched class org.openqa.selenium.remote.server.InMemorySession$Factory (provider: class org.openqa.selenium.firefox.FirefoxDriver)
11:58:32.637 INFO - Capabilities {acceptSslCerts=true, marionette=false, browserName=chrome, javascriptEnabled=true, chromeOptions={args=[disable-infobars]}, platformName=ANY, version=, platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
11:58:32.637 INFO - Capabilities {acceptSslCerts=true, marionette=false, browserName=chrome, javascriptEnabled=true, chromeOptions={args=[disable-infobars]}, platformName=ANY, version=, platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
11:58:32.638 INFO - Capabilities {acceptSslCerts=true, marionette=false, browserName=chrome, javascriptEnabled=true, chromeOptions={args=[disable-infobars]}, platformName=ANY, version=, platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)

Could it be that chromedriver is not correctly located or started? Thanks for all help and advice, and please let me know if I can provide any further information.

barancev commented 7 years ago

What client binding do you use?

mgruner commented 7 years ago

I use the Perl binding Selenium::Remote::Driver, latest version 1.20. It throws an unspecific error message that I don't see in the Selenium log: Could not create new session: Unable to create a new session because of no configuration.

shs96c commented 7 years ago

I'm not familiar with the perl bindings. Could you please tell me how to reproduce this? I need the name of the CPAN module to install, and a sample script to demonstrate the problem.

mgruner commented 7 years ago

Hello @shs96c, of course. I believe I found the problem, and I guess this issue here can be closed. Basically I had a line in extra_capabilites that the chrome driver does not understand, that's why it errored out.

To reproduce, you'd need to install Selenium::Remote::Driver, e. g. via cpanm Selenium::Remote::Driver.

Test script:

use strict;
use warnings;

use Selenium::Remote::Driver;

my $Selenium = Selenium::Remote::Driver->new(
    remote_server_addr  => 'localhost',
    port                => '4444',
    browser_name        => 'chrome',
    platform            => 'ANY',
    extra_capabilities => {
        marionette     => \0,   # Required to run FF 47 or older on Selenium 3+.
        chromeOptions => {
            args => ['disable-infobars'],
        }
    },
);

$Selenium->get('https://www.google.com');
print "Ok.\n";

As you can see, the line marionette => \0, sneaked in from previous tests with an older Firefox. If I put this line into the chromeOptions section, there is a meaningful error:

Could not create new session: unknown error: cannot parse capability: chromeOptions
from unknown error: unrecognized chrome option: marionette

But if it is outside, just in the extraCapabilites like in the test script, the error is not so useful:

Could not create new session: Unable to create a new session because of no configuration.

So it generally works, once the configuration is correctly specified. It could be helpful to improve the error message though. I believe this didn't come from the Perl bindings.