gpt4 book ai didi

java - 使用 Safari 10/Selenium 3.0.1 删除 cookie 时出现异常

转载 作者:太空宇宙 更新时间:2023-11-04 11:54:30 27 4
gpt4 key购买 nike

我在 Safari 10.0 中使用 native SafariDriver 添加和删除 cookie 时遇到问题:通用 WebDriverException被抛出,我正在寻找修复或解决方法。

以下组件会发生这种情况:

  • Mac OS X 10.11.6 (El Capitan)
  • Safari 10.0 [提供 SafariDriver 的 native 实现]
  • Selenium 3.0.1

以下document表示 Safari 10 中的原生 SafariDriver 不再需要安装 Selenium SafariDriver 扩展,而是依赖于 Selenium 3.0 或更高版本。我已确保使用 Selenium 3.x 并且 Selenium 2.x 不在我的系统上。

测试时,浏览器窗口有橙色的 SmartSearch 字段,单击测试窗口时会引发以下异常。由于以下系统属性,我知道测试框架正在使用正确的音频驱动程序,并且抛出的异常表明 Selenium 版本为 3.0.1

webdriver.safari.driver Mac OS X 系统属性设置为 /usr/bin/safaridriver

以下适用于 Safari:

            driver.manage().getCookies();

以下内容在 Safari 中失败,但在 Chrome 中有效

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

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)

最佳答案

这是 safaridriver 中的一个已知问题。它已在 Safari 11 中修复。

关于java - 使用 Safari 10/Selenium 3.0.1 删除 cookie 时出现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41491654/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com