Safari Driver is failing on latest mac and safari -
Hi, Yosemite 10.10.3 & Safari 8.0.6 -- this combination is generating issues with latest selenium.
Jul 18, 2015 7:31:00 PM org.openqa.selenium.safari.SafariDriverServer start
INFO: Server started on port 11871
Jul 18, 2015 7:31:01 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Launching Safari
Jul 18, 2015 7:31:01 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Waiting for SafariDriver to connect
Jul 18, 2015 7:31:03 PM org.openqa.selenium.safari.SafariDriverChannelHandler$1 operationComplete
INFO: Connection opened
Jul 18, 2015 7:31:03 PM org.openqa.selenium.safari.SafariDriverChannelHandler$1 operationComplete
INFO: Connection opened
Jul 18, 2015 7:31:03 PM org.openqa.selenium.safari.SafariDriverChannelHandler$1 operationComplete
WARNING: Failed to register new WebSocket connection
Jul 18, 2015 7:31:03 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Driver connected in 2627 ms
Jul 18, 2015 7:31:03 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Shutting down
Jul 18, 2015 7:31:03 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Closing connection
Jul 18, 2015 7:31:03 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Stopping Safari
Jul 18, 2015 7:31:03 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Stopping server
Jul 18, 2015 7:31:03 PM org.openqa.selenium.safari.SafariDriverServer stop
INFO: Stopping server
Jul 18, 2015 7:31:03 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Shutdown complete
Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.46.0', revision: '61506a4624b13675f24581e453592342b7485d71', time: '2015- 06-04 10:22:50'
System info: host: 'Nabaruns-MacBook-Pro.local', ip: '192.168.1.100', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.4', java.version: '1.8.0_31'
Driver info: driver.version: SafariDriver
Now, here is the code that I try to use :
driver = new SafariDriver();
The idea is that when it calls open - it fails.
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session.
The source is, however -
java.lang.ClassCastException: com.google.gson.JsonObject cannot be cast to java.lang.String
The issue of course, comes from JsonToBeanConverter at line 93.
if (Command.class.equals(clazz)) {
JsonObject json = new JsonParser().parse((String) text).getAsJsonObject();
The text object is the JsonObject thingie - while this poor guy is expecting a string. Thus, probably an type check should fix it?
This was fixed in a recent commit, you can pull down selenium and build it yourself to fix the problem. 2.45 also works fine.
I am using 2.46. I am still having this problem.
@nmondal that's the problem version. 2.45 works. 2.46 doesn't work with Safari.
The fix has been merged into master, but you will need to clone and build yourself for that.
(2.45 has a problem with Firefox, where it will repeatedly throw errors saying that Firefox crashed)
here's the commit hash: 26bf0bc54be8cccab99f4fb2b170bb9aa8ad8030
It'll be released in the future :)
Confirming that this fix works in 47.1. Thanks everyone.
With Mac 10.10.5 and Safari 9.0.2, I am getting this safariDriver log while trying to launch Safari:
11:32:44.49 [safaridriver.extension] Creating global session... 11:32:44.50 [safaridriver.extension.TabManager] Registering new tab 11:32:44.50 [safaridriver.extension.TabManager] Set command tab to 9v6jhaufwzwa 11:32:44.50 [safaridriver.extension] Creating debug driver... 11:32:44.51 [safaridriver.extension] Waiting for connect command... 11:32:44.79 [safaridriver.extension] Loading module(page_base) 11:32:44.82 [safaridriver.extension.Tab] [9v6jhaufwzwa] Tab may be ready; waiting for idle state 11:32:44.92 [safaridriver.extension.Tab] [9v6jhaufwzwa] Tab looks ready; notifying listeners 11:32:44.92 [safaridriver.inject] Content page has requested a WebDriver client connection to ws://localhost:31886 11:32:44.92 [safaridriver.extension.Server] [55ibgx4q2vjg] Attempting to connect to ws://localhost:31886 11:32:44.94 [safaridriver.extension.Server] [55ibgx4q2vjg] WebSocket connection established. 11:32:44.94 [safaridriver.extension] Connected to client: ws://localhost:31886 11:33:27.86 [safaridriver.extension.Server] [55ibgx4q2vjg] WebSocket connection was closed. 11:33:27.86 [safaridriver.extension.Server] [55ibgx4q2vjg] Disposing of server 11:35:58.44 [safaridriver.extension.TabManager] Registering new tab 11:35:58.44 [safaridriver.extension.TabManager] Tab opened: 4bgf06urzj4 11:35:58.54 [safaridriver.extension.TabManager] Ignoring open window event 11:35:58.54 [safaridriver.extension.TabManager] Deleting entry for tab 4bgf06urzj4 11:35:58.80 [safaridriver.extension.Server] [55ibgx4q2vjg] Executing command: newSession
Kindly help me on this. I have latest selenium webdriver 2.48.2 and safaridriver extension 2.48.
Mac Os sierra, Selenium Webdriver 2.48.0 doesn't work with safari 11 ? Any latest webdriver on its way ?
Current version of WebDriver is 3.6.0. SafariDriver itself is now bundled with Safari (as of version 10). See this page for more info.