headspinio / appium-altunity-plugin

An Appium 2.x plugin for AltUnity Tester. https://headspin.io
Apache License 2.0
30 stars 5 forks source link

Unable to rotate screen in Android through alt unity #3

Closed Kanchu8 closed 2 years ago

Kanchu8 commented 2 years ago
  1. We able to get orientation using orientation = self.driver.orientation
  2. Unable to rotate app >> self.driver.orientation = 'LANDSCAPE' Error facing >> selenium.common.exceptions.InvalidElementStateException: Message: Screen rotation cannot be changed to ROTATION_270 after 2000ms. Is it locked programmatically?
  3. Appium log has been attached
  4. appium_rotate_log.txt

jlipps commented 2 years ago
info HTTP --> POST /session/168c05fb-07b7-4fb9-9662-91c298793ff2/orientation
info HTTP {"orientation":"LANDSCAPE"}
[AndroidUiautomator2Driver@ed66 (168c05fb)] Driver proxy active, passing request on via HTTP proxy
[debug] [AndroidUiautomator2Driver@ed66 (168c05fb)] Matched '/session/168c05fb-07b7-4fb9-9662-91c298793ff2/orientation' to command name 'setOrientation'
[debug] [AndroidUiautomator2Driver@ed66 (168c05fb)] Proxying [POST /session/168c05fb-07b7-4fb9-9662-91c298793ff2/orientation] to [POST http://127.0.0.1:8200/session/fadb01d6-b839-4585-b967-7f787041f17e/orientation] with body: {"orientation":"LANDSCAPE"}
[AndroidUiautomator2Driver@ed66 (168c05fb)] Got response with status 400: {"sessionId":"fadb01d6-b839-4585-b967-7f787041f17e","value":{"error":"invalid element state","message":"Screen rotation cannot be changed to ROTATION_270 after 2000ms. Is it locked programmatically?","stacktrace":"io.appium.uiautomator2.common.exceptions.InvalidElementStateException: Screen rotation cannot be changed to ROTATION_270 after 2000ms. Is it locked programmatically?\n\tat io.appium.uiautomator2.model.internal.CustomUiDevice.setRotationSync(CustomUiDevice.java:195)\n\tat io.appium.uiautomator2.handler.SetOrientation.safeHandle(SetOrientation.java:41)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:59)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:267)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:261)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:68)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandle...
[debug] [W3C] Matched W3C error code 'invalid element state' to InvalidElementStateError
info HTTP <-- POST /session/168c05fb-07b7-4fb9-9662-91c298793ff2/orientation 400 2094 ms - 3926

Notice that the log lines mention this command is being handled by the UiAutomator2 driver? That means this issue doesn't have anything to do with this plugin. Unless you can show that the orientation setting works correctly when the plugin is not used, it's best to report the issue to the UiAutomator2 driver repo instead.