Exception while deleting cookies with Safari 10 / Selenium 3.0.1

658 views Asked by At

I'm having a problem adding and deleting cookies with the native SafariDriver in Safari 10.0: A generic WebDriverException is thrown and I'm looking for a fix or a workaround.

This is occurring with the following components:

  • Mac OS X 10.11.6 (El Capitan)
  • Safari 10.0 [provides native implementation of SafariDriver]
  • Selenium 3.0.1

The following document indicates that the native SafariDriver in Safari 10 no longer requires installation of the Selenium SafariDriver extension, but depends on Selenium 3.0 or higher. And I've ensured that Selenium 3.x is being used and that Selenium 2.x is not on my system.

While testing, the browser window has the orange SmartSearch field, and throws the exception below when clicking the test window. I know the test framework is using the correct audio driver because of the following system property,and the fact that the exception thrown indicates the Selenium version as 3.0.1

The webdriver.safari.driver Mac OS X system property is set to /usr/bin/safaridriver

The following works with Safari:

            driver.manage().getCookies();

The following fails with Safari, but works with Chrome

            driver.manage().addCookie(cookie);
            driver.manage().deleteAllCookies();

Exception stack trace for addCookie()

DEBUG [main] (DefaultNavigator.java:201) - Caught exception: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 4 milliseconds

Build info: version: '3.0.1', revision: '1969d75',

time:'2016-10-18 09:49:13 -0700' System info: host: 'L-C02S61GDxxxx', ip: '192.168.47.xxx, os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_112

Driver info: org.openqa.selenium.safari.SafariDriver Capabilities [{applicationCacheEnabled=true, rotatable=false, databaseEnabled=true, handlesAlerts=true, version=11602.3.12.0.1, cleanSession=true, platform=MAC, nativeEvents=true, locationContextEnabled=false, webStorageEnabled=true, browserName=safari, javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID: 7513DEE7-DB0F-4CBD-B21E-D760C69880DB

DEBUG [main] (AbstractTest.java:91) - ###### Executing test: testSignInSuccess 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.ErrorHandler.createThrowable(ErrorHandler.java:216) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635) at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions.addCookie(RemoteWebDriver.java:718) ... 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.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217) at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

1

There are 1 answers

0
Brian Burg On

This was a known issue in safaridriver. It is fixed in Safari 11.