无法使用 appium 打开或关闭数据



我正在尝试在移动浏览器中自动化网站,但我有一个情况需要关闭数据。我正在尝试使用此代码,但它不起作用。

((AndroidDriver)driver)).setConnection(Connection.AIRPLANE);

我在 Appium 上收到以下错误。

[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/2a5f7f01-e387-46f0-ac31-8dd61a6e35a9/element/0
.6472704682468642-1/value] to [POST http://127.0.0.1:8000/wd/hub/session/cdcd3aa83e0133e7e9a73007fe1
843b4/element/0.6472704682468642-1/value] with body: {"id":"0.6472704682468642-1","value":["banana"]
}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"cdcd3aa83e0133e7e9a73007fe1843b4"
,"status":0,"value":null}
[JSONWP Proxy] Replacing sessionId cdcd3aa83e0133e7e9a73007fe1843b4 with 2a5f7f01-e387-46f0-ac31-8dd
61a6e35a9
[HTTP] <-- POST /wd/hub/session/2a5f7f01-e387-46f0-ac31-8dd61a6e35a9/element/0.6472704682468642-1/va
lue 200 634 ms - 76
[HTTP] --> POST /wd/hub/session/2a5f7f01-e387-46f0-ac31-8dd61a6e35a9/network_connection {"name":"net
work_connection","parameters":{"type":1}}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/2a5f7f01-e387-46f0-ac31-8dd61a6e35a9/network_c
onnection] to [POST http://127.0.0.1:8000/wd/hub/session/cdcd3aa83e0133e7e9a73007fe1843b4/network_co
nnection] with body: {"name":"network_connection","parameters":{"type":1}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"cdcd3aa83e0133e7e9a73007fe1843b4"
,"status":13,"value":{"message":"unknown error: operation is unsupported on Androidn  (Session info
: chrome=58.0.3029.83)n  (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc5679
15b233),platform=Windows NT 6.1.7601 SP1 x86_64)"}}
[JSONWP Proxy] Replacing sessionId cdcd3aa83e0133e7e9a73007fe1843b4 with 2a5f7f01-e387-46f0-ac31-8dd
61a6e35a9
[HTTP] <-- POST /wd/hub/session/2a5f7f01-e387-46f0-ac31-8dd61a6e35a9/network_connection 200 26 ms -
302
[HTTP] --> DELETE /wd/hub/session/2a5f7f01-e387-46f0-ac31-8dd61a6e35a9 {}
[debug] [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["2a5f7f01-e387-46f0-ac31-8dd61a6e
35a9"]
[debug] [BaseDriver] Event 'quitSessionRequested' logged at 1498038746866 (15:22:26 GMT+0530 (India
Standard Time))
[debug] [AndroidDriver] Shutting down Android driver

日志错误 -

org.jbehave.core.embedder.PerformableTree$SomethingHappened@30546a64: org.openqa.selenium.WebDriverException: unknown error: operation is unsupported on Android
  (Session info: chrome=58.0.3029.83)
  (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 35 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'GH-XXXXXXX', ip: 'xxx.xxx.xxx.xxx', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_20'

我在这里错过了什么吗?

Appium 版本 - 1.6.4

在 中使用Connection.AIRPLANE

driver.setConnection(Connection.AIRPLANE);

仅适用于安卓版本 6.0 及更高版本(适用于模拟器(

请查看appium文档以参考driver.setConnection()

https://appium.readthedocs.io/en/stable/en/writing-running-appium/network_connection/

相关内容

  • 没有找到相关文章

最新更新