0

Since upgrading to Safari 11 last night, my automated tests will not run against safari.

It should be noted that I run Remotely using 'http://localhost:4444/wd/hub' because I find the “glass pane” gets in the way of things that i need to be able to do.

In my terminal for starting webdriver it starts fine and then returns the following error:

UPDATED:

 23:23:25.398 INFO - Executing: [new session: Capabilities [{browserName=safari}]])
23:23:25.399 INFO - Creating a new session for Capabilities [{browserName=safari}]
23:23:25.404 INFO - Server started on port 26778
23:23:25.405 INFO - Launching Safari
23:23:25.406 INFO - Waiting for SafariDriver to connect
23:23:35.410 INFO - Shutting down
23:23:35.410 INFO - Stopping Safari
23:23:35.464 INFO - Stopping server
23:23:35.465 INFO - Stopping server
23:23:35.466 INFO - Shutdown complete
23:23:35.466 INFO - Shutting down
23:23:35.467 INFO - Stopping server
23:23:35.467 INFO - Shutdown complete
23:23:35.631 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'ANTHONYs-MacBook-Pro.local', ip: '10.37.129.2', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_121'
Driver info: driver.version: unknown
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
    at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
    at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
    at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:124)
    at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)
    at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
    at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
    at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:79)
    at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:202)
    at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:164)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:130)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
    at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
    at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
    at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
    at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
    at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
    at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
    at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
    at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'ANTHONYs-MacBook-Pro.local', ip: '10.37.129.2', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_121'
Driver info: driver.version: unknown
    at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:113)
    at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:97)
    at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:103)
    ... 9 more
Caused by: org.openqa.selenium.remote.UnreachableBrowserException: Failed to connect to SafariDriver after 10060 ms
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'ANTHONYs-MacBook-Pro.local', ip: '10.37.129.2', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_121'
Driver info: driver.version: SafariDriver
    at org.openqa.selenium.safari.SafariDriverCommandExecutor.start(SafariDriverCommandExecutor.java:121)
    at org.openqa.selenium.safari.SafariDriver.startClient(SafariDriver.java:76)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
    at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:62)
    at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:53)
    ... 14 more
23:23:35.634 WARN - Exception: Failed to connect to SafariDriver after 10060 ms
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'ANTHONYs-MacBook-Pro.local', ip: '10.37.129.2', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_121'
Driver info: driver.version: SafariDriver

In my terminal window where I run the automated script I am seeing:

    /Users/antb/Desktop/project/node_modules/selenium-webdriver/lib/promise.js:2626
        throw error;
        ^

WebDriverError: Failed to connect to SafariDriver after 10060 ms
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'ANTHONYs-MacBook-Pro.local', ip: '10.37.129.2', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_121'
Driver info: driver.version: SafariDriver
    at WebDriverError (/Users/antb/Desktop/project/node_modules/selenium-webdriver/lib/error.js:27:5)
    at Object.checkLegacyResponse (/Users/antb/Desktop/project/node_modules/selenium-webdriver/lib/error.js:546:15)
    at parseHttpResponse (/Users/antb/Desktop/project/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/Users/antb/Desktop/project/node_modules/selenium-webdriver/lib/http.js:441:30)
    at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.createSession()
    at Function.createSession (/Users/antb/Desktop/project/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
    at createDriver (/Users/antb/Desktop/project/node_modules/selenium-webdriver/index.js:170:33)
    at Builder.build (/Users/antb/Desktop/project/node_modules/selenium-webdriver/index.js:635:14)
    at Object.<anonymous> (/Users/antb/Desktop/project/BigIdeas_POM.js:1157:6)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)

I think it may be some path issue, but it's eluding me as to where I need to make the specific change. I tried many things (upgrading to the selenium 3.6.0 jar, upgrading node.js, upgrading java, this Failed to connect to SafariDriver (Safari 10) etc. but those did not done the trick.

The Browser says, briefly:

SafariDriver Launcher

[  0.024s] [safaridriver.client] Connecting to SafariDriver browser extension...
[  0.041s] [safaridriver.client] This will fail if you have not installed the latest SafariDriver extension from
http://selenium-release.storage.googleapis.com/index.html
[  0.042s] [safaridriver.client] Extension logs may be viewed by clicking the Selenium [✓] button on the Safari toolbar
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
QualiT
  • 1,934
  • 2
  • 18
  • 37

2 Answers2

1

I see your safari client binding are 2.52, you should be using 3.6

Caused by: org.openqa.selenium.remote.UnreachableBrowserException: Failed to connect to SafariDriver after 10065 ms
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'

check if you have latest version of selenium-webdriver client binding take a look at this link

user8672807
  • 124
  • 5
  • That sounds like the culprit, but I don't know how those are installed. I've upgraded node.js and the selenium-webdriver and have the 3.6.0 selenium standalone jar. What step am I missing here? – QualiT Oct 11 '17 at 18:00
  • can you add the latest error you are getting after upgrade? also see if remote – user8672807 Oct 12 '17 at 00:18
  • as I suggested in previous comment you need to install the latest selenium bindings 'npm install selenium-webdriver' and uninstall any safaridriver extension you may have from safari – user8672807 Oct 13 '17 at 21:03
  • I've done that. The same error. I did notice during the webdriver install that I get two warnings: npm WARN enoent ENOENT: no such file or directory, open '/Users/anthonybeck/Desktop/evotext/package.json' npm WARN enoent ENOENT: no such file or directory, open '/Users/anthonybeck/Desktop/evotext/node_modules/webdriverio/node_modules/request/node_modules/form-data/node_modules/async/package.json' – QualiT Oct 13 '17 at 21:26
  • I copied over my last working copy of package.json and now the 'npm install selenium-webdriver' install runs without errors. I still get the same error message when I try to run the scripts against Safari 11. – QualiT Oct 13 '17 at 21:40
  • can you please add your source code, that will help – user8672807 Oct 14 '17 at 04:52
  • I would suggest you uninstall and install the selenium-webdriver, instructions are listed here.[link]( https://www.npmjs.com/package/selenium-webdriver) which was update week back, I work with Java client bindings and haven't worked much with JS, but I can tell for sure that you have old client bindings and they are not compatible with W3C spec and latest safaridriver adhere to W3C spec – user8672807 Oct 15 '17 at 02:46
  • Upgraded to High Sierra, installed WebDriver Manager, I'm now at 3.6.0 but I still cannot get Safari to launch in Remote mode connected using the selenium jar. It's in glass pane again, which is really unfortunate. For my situation, that thing causes more problems than it solves. – QualiT Oct 16 '17 at 16:59
  • 1
    the issues seems to be with client bindings, the program which sends out the instructions to hub to invoke the browser. are you still seeing reference to 2.52? if not then its different issue, also can you attach your code? – user8672807 Oct 17 '17 at 00:06
  • user8672807, I am passed the error in the description, and the references to Build 2.52 are now references to build 3.6.0. The problem is that I am still stuck with the glass pane. The script runs, but it crashes at places that it does not when not run in glass pane. I think there are differences between how safariDriver works with webdriver (with the "glass pane") and how it runs when using the selenium-standalone server. Anyway, sharing code in next comment. It starts up, but you can tell it is in glass pane. – QualiT Oct 17 '17 at 06:10
  • "When running a WebDriver test in Safari, test execution is confined to special Automation windows that are isolated from normal browsing windows, user settings, and preferences. Automation windows are easy to recognize by their orange Smart Search field." Does what I am trying to do make sense to you? – QualiT Oct 17 '17 at 06:10
0

I tried on:

os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_65'

and the current latest version of Safari (Version 11.0 (12604.1.38.1.7)).

If I use Selenium 2.52.0 doesn't work.

If I use the current latest release of Selenium it works.

From your exception you are using the 2.52.0. You must update it.

Davide Patti
  • 3,391
  • 2
  • 18
  • 20