Send keys not works in android container


#1

I create custom android image from selenoid project with next params:
Appium version: 1.9.1
Android version: 8.0
Device: Nexus 9
Chrome browser: no
Chromedriver version: 2.34

Also to Dockerfile to run section add libgconf-2-4 for ubuntu platform

When use sendkeys method got exception:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: unknown error: an X display is required for keycode conversions, consider using Xvfb (Session info: chrome=44.0.2403.119) (Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Linux 4.9.0-8-amd64 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 0 milliseconds Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z' System info: host: 'lin-build-7', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.0-8-amd64', java.version: '1.8.0_152' Driver info: mobileApplication.drivers.AndroidMobileDriver Capabilities {androidNaturalOrientation: true, app: /etc/cordova/*-debug..., appActivity: *.MainActivity, appPackage: *, appWaitActivity: *.MainActivity, appWaitPackage: *, autoGrantPermissions: true, browserName: android, clearSystemFiles: true, databaseEnabled: false, desired: {androidNaturalOrientation: true, app: /etc/cordova/*-debug..., appActivity: *.MainActivity, appWaitActivity: **.MainActivity, autoGrantPermissions: true, browserName: android, clearSystemFiles: true, deviceName: emulator-5554, enableVNC: false, enableVideo: false, javascriptEnabled: true, name: androidContainerWithThreadN..., nativeWebScreenshot: true, newCommandTimeout: 3600, noReset: true, orientation: LANDSCAPE, platformName: Android, recreateChromeDriverSessions: true, resetKeyboard: true, takesScreenshot: true, udid: emulator-5554, version: 6.0}, deviceManufacturer: unknown, deviceModel: Android SDK built for x86, deviceName: emulator-5554, deviceScreenSize: 2048x1536, deviceUDID: emulator-5554, enableVNC: false, enableVideo: false, javascriptEnabled: true, locationContextEnabled: false, name: androidContainerWithThreadN..., nativeWebScreenshot: true, networkConnectionEnabled: true, newCommandTimeout: 3600, noReset: true, orientation: LANDSCAPE, platform: LINUX, platformName: Android, platformVersion: 6.0, recreateChromeDriverSessions: true, resetKeyboard: true, takesScreenshot: true, udid: emulator-5554, version: 6.0, warnings: {}, webStorageEnabled: false} Session ID: 97185e6e-7741-45de-83a9-2e6c5de38072 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:214) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166) at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40) at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80) at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:231) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)

Next error got while execute:

( (JavascriptExecutor) driver ).executeScript( script )("var elem=arguments[0]; jQuery(\"#\"+elem.id).trigger(\"change\")", getWebElement( by ) );
Exception:
org.openqa.selenium.WebDriverException: unknown error: jQuery is not defined (Session info: chrome=71.0.3578.98) (Driver info: chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 4.9.0-8-amd64 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 0 milliseconds Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z' System info: host: 'lin-build-7', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.0-8-amd64', java.version: '1.8.0_152' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.45.615279 (12b89733300bd2..., userDataDir: /opt/teamcity/BuildAgent/te...}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:17631}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(), rotatable: false, setWindowRect: true, strictFileInteractability: false, takesHeapSnapshot: true, takesScreenshot: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unexpectedAlertBehaviour: ignore, unhandledPromptBehavior: ignore, version: 71.0.3578.98, webStorageEnabled: true} Session ID: 4a6ec01002647b08c7669ef14ce9d446 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:214) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166) at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40) at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80) at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:485)

On real device or emulator that setup not in docker container everything works well
Also checked on other configuration: Android 6.0 (chromedriver 2.20)

Also create https://github.com/aerokube/selenoid-images/issues/114

Please advise