java-client
java-client copied to clipboard
getBatteryInfo() throw 'Response cannot be cast to java.util.Map' exception
Description
java.lang.ClassCastException: org.openqa.selenium.remote.Response cannot be cast to java.util.Map
at io.appium.java_client.ios.IOSDriver.getBatteryInfo(IOSDriver.java:191)
at ios_appium.App.main(App.java:52)
...
capabilities.setCapability(IOSMobileCapabilityType.UPDATE_WDA_BUNDLEID, "com.appium.ios");
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
capabilities.setCapability(IOSMobileCapabilityType.WDA_LAUNCH_TIMEOUT, 60000);
capabilities.setCapability(IOSMobileCapabilityType.WDA_CONNECTION_TIMEOUT, 16000);
capabilities.setCapability(IOSMobileCapabilityType.COMMAND_TIMEOUTS, "{\"findElement\": 8000, \"findElements\": 15000, \"setValue\": 8000, \"default\": 16000}");
driver = new IOSDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
IOSBatteryInfo batteryInfo = driver.getBatteryInfo();
System.out.println();
}catch (Throwable e){
e.printStackTrace();
}finally {
driver.quit();
}
...
Environment
- java client build version 1.8
- Appium server version 1.8.1
- Desktop OS/version MAC/10.13.5
- Node.js version 8.11.2
- Mobile platform/version REAL DEVICE IOS/11.3
- java-client 6.0.0
Details
Can you attach the server log?
@mykola-mokhnach
[HTTP] --> POST /wd/hub/session/5ed64f42-e065-4fe7-97d5-a9d00b782df6/execute/sync
[HTTP] {"script":"mobile: batteryInfo","args":[]}
[debug] [W3C] Calling AppiumDriver.execute() with args: ["mobile: batteryInfo",[],"5ed64f42-e065-4fe7-97d5-a9d00b782df6"]
[debug] [XCUITest] Executing command 'execute'
[XCUITest] Proxying to WDA with an unknown route: GET /wda/batteryInfo
[debug] [XCUITest] Setting custom timeout to 16000 ms for 'Unknown' command
[debug] [JSONWP Proxy] Proxying [GET /wda/batteryInfo] to [GET http://localhost:8100/session/61BC5950-CD0E-4D0D-8ED7-BA62037D2D2C/wda/batteryInfo] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\n \"value\" : {\n \"level\" : 1,\n \"state\" : 2\n },\n \"sessionId\" : \"61BC5950-CD0E-4D0D-8ED7-BA62037D2D2C\",\n \"status\" : 0\n}"
[debug] [W3C] Responding to client with driver.execute() result: {"level":1,"state":2}
the PR is awaiting for the review. For now you can use executeScript with mobile: batteryInfo argument as a workaround