我尝试在Android模拟器上设置AIRPLANE模式,但在执行后我得到:
org.openqa.selenium.WebDriverException: undefined status object (WARNING: The server did not provide any stacktrace information)
我的代码:
public static void enableAirplaneMode(){
driver.setConnection(Connection.AIRPLANE);
assertEquals(Connection.AIRPLANE, driver.getConnection());
classLogger.log(Level.INFO, "Connection type is set: " + driver.getConnection());
}
步骤后 - > driver.setConnection(Connection.AIRPLANE); - >在模拟器上启用了两种模式,我在模拟器设置(AIRPLANE和DATA)而不是AIRPLANE上看到它。执行失败了:
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 io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at io.appium.java_client.CommandExecutionHelper.execute(CommandExecutionHelper.java:32)
at io.appium.java_client.android.AndroidDriver.setConnection(AndroidDriver.java:230)
at core.screen_driver.ConfigureEmulatorOS.enableAirplaneMode(ConfigureEmulatorOS.java:33)
at step_definitions.GeneralDefs.enableAirplane(GeneralDefs.java:109)
也许有人解决了这个案子?
答案 0 :(得分:0)
在
中使用Connection.AIRPLANE
driver.setConnection(Connection.AIRPLANE);
仅适用于Android 6.0及以上版本(For Emulators)
请查看appium文档以参考driver.setConnection()
https://appium.readthedocs.io/en/stable/en/writing-running-appium/network_connection/
我还建议更新到最新的java-client和appium服务器。