letsrokk / appium-android-xwalk-driver-patch

Appium Android Driver patch to support Crosswalk (Cordova) Hybrid Apps
Apache License 2.0
4 stars 1 forks source link

Still necessary? #2

Closed mwager closed 6 years ago

mwager commented 7 years ago

Hi, I tried your patch, but then I got another error (see above).

Is this patch still necessary or are there other solutions now?

[15:33:29] I/launcher - Running 1 instances of WebDriver
[15:33:29] I/hosted - Using the selenium server at http://localhost:4723/wd/hub
[15:33:37] E/runner - Unable to start a WebDriver session.
[15:33:39] E/launcher - Error: WebDriverError: An unknown server-side error occurred while processing the command. Original error: Invalid timeout 'script'
    at Object.checkLegacyResponse (/Users/work/Projects/mswag/lbo/e2e/node_modules/selenium-webdriver/lib/error.js:505:15)
    at parseHttpResponse (/Users/work/Projects/mswag/lbo/e2e/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/Users/work/Projects/mswag/lbo/e2e/node_modules/selenium-webdriver/lib/http.js:440:13)
    at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.manage().timeouts().setScriptTimeout(11000)
    at WebDriver.schedule (/Users/work/Projects/mswag/lbo/e2e/node_modules/selenium-webdriver/lib/webdriver.js:816:17)
    at Timeouts._scheduleCommand (/Users/work/Projects/mswag/lbo/e2e/node_modules/selenium-webdriver/lib/webdriver.js:1500:25)
    at Timeouts.setScriptTimeout (/Users/work/Projects/mswag/lbo/e2e/node_modules/selenium-webdriver/lib/webdriver.js:1483:17)
    at browser_.ready.browser_.ready.then.then (/Users/work/Projects/mswag/lbo/e2e/node_modules/protractor/lib/runner.ts:281:49)
    at ManagedPromise.invokeCallback_ (/Users/work/Projects/mswag/lbo/e2e/node_modules/selenium-webdriver/lib/promise.js:1366:14)
    at TaskQueue.execute_ (/Users/work/Projects/mswag/lbo/e2e/node_modules/selenium-webdriver/lib/promise.js:2970:14)
    at TaskQueue.executeNext_ (/Users/work/Projects/mswag/lbo/e2e/node_modules/selenium-webdriver/lib/promise.js:2953:27)
    at asyncRun (/Users/work/Projects/mswag/lbo/e2e/node_modules/selenium-webdriver/lib/promise.js:2813:27)
    at /Users/work/Projects/mswag/lbo/e2e/node_modules/selenium-webdriver/lib/promise.js:676:7
    at process._tickCallback (internal/process/next_tick.js:109:7)
Closing report
[15:33:39] E/launcher - Process exited with error code 100

Appium logs

...
[HTTP] <-- POST /wd/hub/session 200 8003 ms - 1154 
[HTTP] --> POST /wd/hub/session/9bd0ec13-6078-4aee-971f-5060c7c84e73/timeouts {"type":"script","ms":11000}
[debug] [MJSONWP] Calling AppiumDriver.timeouts() with args: ["script",11000,"9bd0ec13-6078-4aee-971f-5060c7c84e73"]
[MJSONWP] Encountered internal error running command: Error: Invalid timeout 'script'
    at AndroidDriver.callee$0$0$ (../../../../lib/basedriver/commands/timeout.js:23:13)
    at tryCatch (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at invoke (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at enqueueResult (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/babel-runtime/regenerator/runtime.js:185:17)
    at F (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/core-js/library/modules/$.export.js:30:36)
    at AsyncIterator.enqueue (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/babel-runtime/regenerator/runtime.js:184:12)
    at AsyncIterator.prototype.(anonymous function) [as next] (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at Object.runtime.async (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/babel-runtime/regenerator/runtime.js:209:12)
    at AndroidDriver.callee$0$0 [as timeouts] (../../../../lib/basedriver/commands/timeout.js:14:9)
    at ../../../lib/basedriver/driver.js:218:24
    at tryCatcher (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/bluebird/js/main/promise.js:510:31)
    at Promise._settlePromiseAt (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/bluebird/js/main/promise.js:584:18)
    at Promise._settlePromiseAtPostResolution (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/bluebird/js/main/promise.js:248:10)
    at Async._drainQueue (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/bluebird/js/main/async.js:128:12)
    at Async._drainQueues (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues (/Users/work/.nvm/versions/node/v7.7.1/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/bluebird/js/main/async.js:15:14)
    at runCallback (timers.js:666:20)
    at tryOnImmediate (timers.js:639:5)
    at processImmediate [as _immediateCallback] (timers.js:611:5)
[HTTP] <-- POST /wd/hub/session/9bd0ec13-6078-4aee-971f-5060c7c84e73/timeouts 500 19 ms - 195 
[HTTP] --> DELETE /wd/hub/session/9bd0ec13-6078-4aee-971f-5060c7c84e73 {}
[debug] [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["9bd0ec13-6078-4aee-971f-5060c7c84e73"]
[debug] [AndroidDriver] Shutting down Android driver
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected

...

Environment infos:

$ appium --version
1.6.3

$ node -v
v7.7.1

$ protractor --version
Version 5.1.1
letsrokk commented 7 years ago

@mwager hi! as far as I know this patch is not compatible with Appium 1.6.x, as it was created for 1.5.3. And afaik original issue is still open: https://github.com/appium/appium/issues/4597

Unfortunately, right now I can only recommend using Appium 1.5.3 with Android and 1.6.3 with iOS (iOS works fine without patch) and wait for issue to be resolved :|

mwager commented 7 years ago

Thanks! Tried with appium@1.5.3 but same error

[09:37:11] E/runner - Unable to start a WebDriver session.
[09:37:13] E/launcher - Error: WebDriverError: An unknown server-side error occurred while processing the command. Original error: Invalid timeout 'script'

Appium logs
[debug] [MJSONWP] Calling AppiumDriver.timeouts() with args: ["script",11000,"0fb42528-24d8-4fe3-a463-28d6e6e4d81d"]
[MJSONWP] Encountered internal error running command: Error: Invalid timeout 'script'

I think we will run the tests against the app built without crosswalk for now until the original issue was resolved.

Thanks for your patch & help anyway!

pandabat commented 7 years ago

Just FYI, I've also tried your patch with Appium 1.5.3. I'm using Linux 64 (Fedora 24) so I've been using the xwalkdriver64_release from here: https://github.com/crosswalk-project/crosswalk-web-driver/tree/master/bin

Maybe I should be using a different driver? The one at http://www.megafileupload.com/fo3m/chromedriver no longer exists so unsure as to best one for x64 Linux.

Anyway, running with that xwalkdriver64_release and your patch, I end up with WebDriverException: Message: no such session

Been running around in circles with this for a while now. Proper integration of https://codereview.chromium.org/2375613002/ and any subsequent necessary fixes to Appium can't come soon enough. Thanks for patch anyway even if it doesn't work for me.

Can technically switch between contexts but when one tries to do anything (like wait for an element) in the webview then the problems start

[HTTP] --> POST /wd/hub/session {"requiredCapabilities":{},"desiredCapabilities":{"deviceName":"10.254.222.2:5555","automationName":"Appium","androidDeviceSocket":"com.companyname.AppName_devtools_remote","chromeOptions":{"androidDeviceSocket":"com.companyname.AppName_devtools_remote"},"browserName":"","platformVersion":"4.4.2","appPackage":"com.companyname.AppName","platformName":"Android","appActivity":".AppName"}} [MJSONWP] Calling AppiumDriver.createSession() with args: [{"deviceName":"10.254.222.... [Appium] Creating new AndroidDriver session [Appium] Capabilities: [Appium] deviceName: '10.254.222.2:5555' [Appium] automationName: 'Appium' [Appium] androidDeviceSocket: 'com.companyname.AppName_devtools_remote' [Appium] chromeOptions: { androidDeviceSocket: 'com.companyname.AppName_devtools_remote' } [Appium] browserName: '' [Appium] platformVersion: '4.4.2' [Appium] appPackage: 'com.companyname.AppName' [Appium] platformName: 'Android' [Appium] appActivity: '.AppName' [BaseDriver] Session created with session id: 0becbc0d-e1b6-4c37-b72d-58570e48285f [debug] [AndroidDriver] Getting Java version [AndroidDriver] Java version is: 1.8.0_121 [ADB] Checking whether adb is present [ADB] Using adb from /home/pandabat/androidSDK/platform-tools/adb [AndroidDriver] Retrieving device list [debug] [ADB] Trying to find a connected android device [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [AndroidDriver] Looking for a device with Android 4.4.2 [debug] [ADB] Setting device id to 10.254.222.2:5555 [ADB] Getting device platform version [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","getprop","ro.build.version.release"] [AndroidDriver] Using device: 10.254.222.2:5555 [ADB] Checking whether adb is present [ADB] Using adb from /home/pandabat/androidSDK/platform-tools/adb [debug] [ADB] Setting device id to 10.254.222.2:5555 [AndroidDriver] App file was not listed, instead we're going to run com.companyname.AppName directly on the device [debug] [AndroidDriver] Checking whether package is present on the device [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","pm","list","packages","com.companyname.AppName"] [AndroidDriver] Starting Android session [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","wait-for-device"] [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","echo","ping"] [debug] [Logcat] Starting logcat capture [debug] [AndroidDriver] Pushing settings apk to device... [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","install","/usr/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/io.appium.settings/bin/settings_apk-debug.apk"] [debug] [AndroidDriver] Pushing unlock helper app to device... [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","install","/usr/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-unlock/bin/unlock_apk-debug.apk"] [ADB] Getting device platform version [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","getprop","ro.build.version.release"] [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","dumpsys","window"] [AndroidDriver] Screen already unlocked, doing nothing [debug] [AndroidBootstrap] Watching for bootstrap disconnect [debug] [ADB] Forwarding system: 4724 to device: 4724 [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","forward","tcp:4724","tcp:4724"] [debug] [UiAutomator] Starting UiAutomator [debug] [UiAutomator] Moving to state 'starting' [debug] [UiAutomator] Parsing uiautomator jar [debug] [UiAutomator] Found jar name: 'AppiumBootstrap.jar' [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","push","/usr/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-android-bootstrap/bootstrap/bin/AppiumBootstrap.jar","/data/local/tmp/"] [debug] [ADB] Attempting to kill all uiautomator processes [debug] [ADB] Getting all processes with uiautomator [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","ps","uiautomator"] [ADB] No uiautomator process found to kill, continuing... [debug] [UiAutomator] Starting UIAutomator [debug] [ADB] Creating ADB subprocess with args: -P, 5037, -s, 10.254.222.2:5555, shell, uiautomator, runtest, AppiumBootstrap.jar, -c, io.appium.android.bootstrap.Bootstrap, -e, pkg, com.companyname.AppName, -e, disableAndroidWatchers, false, -e, acceptSslCerts, false [debug] [UiAutomator] Moving to state 'online' [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers. [AndroidBootstrap] Android bootstrap socket is now connected [debug] [ADB] Getting connected devices... [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","getprop","ro.build.version.sdk"] [debug] [ADB] Device API level: 19 [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","am","start","-n","com.companyname.AppName/.AppName","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"] [Appium] New AndroidDriver session created successfully, session 0becbc0d-e1b6-4c37-b72d-58570e48285f added to master session list [MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webSto... [HTTP] <-- POST /wd/hub/session 200 6927 ms - 972 [HTTP] --> GET /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/contexts {} [MJSONWP] Calling AppiumDriver.getContexts() with args: ["0becbc0d-e1b6-4c37-b72d-5... [debug] [AndroidDriver] Getting a list of available webviews [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","cat","/proc/net/unix"] [debug] [AndroidDriver] Available contexts: ["NATIVE_APP","CHROMIUM"] [MJSONWP] Responding to client with driver.getContexts() result: ["NATIVE_APP","CHROMIUM"] [HTTP] <-- GET /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/contexts 200 103 ms - 97 [HTTP] --> GET /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/contexts {} [MJSONWP] Calling AppiumDriver.getContexts() with args: ["0becbc0d-e1b6-4c37-b72d-5... [debug] [AndroidDriver] Getting a list of available webviews [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","cat","/proc/net/unix"] [debug] [AndroidDriver] Available contexts: ["NATIVE_APP","CHROMIUM"] [MJSONWP] Responding to client with driver.getContexts() result: ["NATIVE_APP","CHROMIUM"] [HTTP] <-- GET /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/contexts 200 100 ms - 97 [HTTP] --> POST /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/context {"sessionId":"0becbc0d-e1b6-4c37-b72d-58570e48285f","name":"CHROMIUM"} [MJSONWP] Calling AppiumDriver.setContext() with args: ["CHROMIUM","0becbc0d-e1b6-... [debug] [AndroidDriver] Getting a list of available webviews [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","cat","/proc/net/unix"] [debug] [AndroidDriver] Available contexts: ["NATIVE_APP","CHROMIUM"] [debug] [AndroidDriver] Connecting to chrome-backed webview context 'CHROMIUM' [debug] [Chromedriver] Changed state to 'starting' [Chromedriver] Set chromedriver binary as: /usr/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver/chromedriver/linux/chromedriver_64 [Chromedriver] Killing any old chromedrivers, running: pkill -15 -f "/usr/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver/chromedriver/linux/chromedriver_64.*--port=9515" [Chromedriver] No old chromedrivers seemed to exist [Chromedriver] Spawning chromedriver with: /usr/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver/chromedriver/linux/chromedriver_64 --url-base=wd/hub --port=9515 --adb-port=5037 [Chromedriver] [STDOUT] Starting XwalkDriver (v2.5.ede663c5c5362a073e538cdabacf85612bc9e16a) on port 9515 Only local connections are allowed. [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://127.0.0.1:9515/wd/hub/status] with no body [debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Linux\",\"version\":\"4.9.15-100.fc24.x86_64+debug\"}}}" [debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.companyname.AppName","androidUseRunningApp":true,"androidDeviceSocket":"com.companyname.AppName_devtools_remote","androidDeviceSerial":"10.254.222.2:5555"}}} [debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"6e3a1e589ed82da3d6323663d61564e5","status":13,"value":{"message":"unknown error: cannot find xwalk binary\n (Driver info: xwalkdriver=2.5.ede663c5c5362a073e538cdabacf85612bc9e16a,platform=Linux 4.9.15-100.fc24.x86_64+debug x86_64)"}} [debug] [Chromedriver] Changed state to 'online' [MJSONWP] Responding to client with driver.setContext() result: null [HTTP] <-- POST /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/context 200 341 ms - 76 [HTTP] --> POST /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/elements {"using":"css selector","sessionId":"0becbc0d-e1b6-4c37-b72d-58570e48285f","value":"#home-menu"} [MJSONWP] Driver proxy active, passing request on via HTTP proxy [debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/elements] to [POST http://127.0.0.1:9515/wd/hub/session/6e3a1e589ed82da3d6323663d61564e5/elements] with body: {"using":"css selector","sessionId":"0becbc0d-e1b6-4c37-b72d-58570e48285f","value":"#home-menu"} [debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"6e3a1e589ed82da3d6323663d61564e5","status":6,"value":{"message":"no such session\n (Driver info: xwalkdriver=2.5.ede663c5c5362a073e538cdabacf85612bc9e16a,platform=Linux 4.9.15-100.fc24.x86_64+debug x86_64)"}} [JSONWP Proxy] Replacing sessionId 6e3a1e589ed82da3d6323663d61564e5 with 0becbc0d-e1b6-4c37-b72d-58570e48285f [HTTP] <-- POST /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/elements 200 10 ms - 227 [HTTP] --> GET /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/context {} [MJSONWP] Calling AppiumDriver.getCurrentContext() with args: ["0becbc0d-e1b6-4c37-b72d-5... [MJSONWP] Responding to client with driver.getCurrentContext() result: "CHROMIUM" [HTTP] <-- GET /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/context 200 4 ms - 82 [HTTP] --> POST /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/context {"sessionId":"0becbc0d-e1b6-4c37-b72d-58570e48285f","name":"NATIVE_APP"} [MJSONWP] Calling AppiumDriver.setContext() with args: ["NATIVE_APP","0becbc0d-e1b... [debug] [AndroidDriver] Getting a list of available webviews [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","cat","/proc/net/unix"] [debug] [AndroidDriver] Available contexts: ["NATIVE_APP","CHROMIUM"] [MJSONWP] Responding to client with driver.setContext() result: null [HTTP] <-- POST /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/context 200 99 ms - 76 [HTTP] --> GET /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/screenshot {} [MJSONWP] Calling AppiumDriver.getScreenshot() with args: ["0becbc0d-e1b6-4c37-b72d-5... [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","/system/bin/rm","/data/local/tmp/screenshot.png;","/system/bin/screencap","-p","/data/local/tmp/screenshot.png"] [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","pull","/data/local/tmp/screenshot.png","/tmp/appium117223-15948-1lgn4qy.png"] [MJSONWP] Responding to client with driver.getScreenshot() result: "iVBORw0KGgoAAAANSUhEUgAAB4... [HTTP] <-- GET /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/screenshot 200 4820 ms - 1923826 [HTTP] --> POST /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/context {"sessionId":"0becbc0d-e1b6-4c37-b72d-58570e48285f","name":"CHROMIUM"} [MJSONWP] Calling AppiumDriver.setContext() with args: ["CHROMIUM","0becbc0d-e1b6-... [debug] [AndroidDriver] Getting a list of available webviews [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","cat","/proc/net/unix"] [debug] [AndroidDriver] Available contexts: ["NATIVE_APP","CHROMIUM"] [debug] [AndroidDriver] Connecting to chrome-backed webview context 'CHROMIUM' [debug] [AndroidDriver] Found existing Chromedriver for context 'CHROMIUM'. Using it. [debug] [JSONWP Proxy] Proxying [GET /url] to [GET http://127.0.0.1:9515/wd/hub/session/6e3a1e589ed82da3d6323663d61564e5/url] with no body [debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"6e3a1e589ed82da3d6323663d61564e5\",\"status\":6,\"value\":{\"message\":\"no such session\n (Driver info: xwalkdriver=2.5.ede663c5c5362a073e538cdabacf85612bc9e16a,platform=Linux 4.9.15-100.fc24.x86_64+debug x86_64)\"}}" [MJSONWP] Responding to client with driver.setContext() result: null [HTTP] <-- POST /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/context 200 105 ms - 76 [HTTP] --> POST /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/context {"sessionId":"0becbc0d-e1b6-4c37-b72d-58570e48285f","name":"CHROMIUM"} [MJSONWP] Calling AppiumDriver.setContext() with args: ["CHROMIUM","0becbc0d-e1b6-... [debug] [AndroidDriver] Getting a list of available webviews [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] Running /home/pandabat/androidSDK/platform-tools/adb with args: ["-P",5037,"-s","10.254.222.2:5555","shell","cat","/proc/net/unix"] [debug] [AndroidDriver] Available contexts: ["NATIVE_APP","CHROMIUM"] [MJSONWP] Responding to client with driver.setContext() result: null [HTTP] <-- POST /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/context 200 98 ms - 76 [HTTP] --> POST /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/elements {"using":"css selector","sessionId":"0becbc0d-e1b6-4c37-b72d-58570e48285f","value":"#home-time > h1:nth-child(1)"} [MJSONWP] Driver proxy active, passing request on via HTTP proxy [debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/0becbc0d-e1b6-4c37-b72d-58570e48285f/elements] to [POST http://127.0.0.1:9515/wd/hub/session/6e3a1e589ed82da3d6323663d61564e5/elements] with body: {"using":"css selector","sessionId":"0becbc0d-e1b6-4c37-b72d-58570e48285f","value":"#home-time > h1:nth-child(1)"} [debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"6e3a1e589ed82da3d6323663d61564e5","status":6,"value":{"message":"no such session\n (Driver info: xwalkdriver=2.5.ede663c5c5362a073e538cdabacf85612bc9e16a,platform=Linux 4.9.15-100.fc24.x86_64+debug x86_64)"}} [JSONWP Proxy] Replacing sessionId 6e3a1e589ed82da3d6323663d61564e5 with 0becbc0d-e1b6-4c37-b72d-58570e48285f

letsrokk commented 7 years ago

@pandabat I had this kind of issue ("no such session") when I used un-patched chromedriver

that's unfortunately that patched chromedriver for Linux is no longer available, you might want to try and build it yourself, here you can find instructions: https://github.com/piotrekkmt/chromedriver-appium

but I'm not sure how up to date those instructions are

pandabat commented 7 years ago

I'm going to try to build it - not sure how it will work out though. Bravely onward! :) THanks

pandabat commented 7 years ago

I did build a patched chromedriver myself and it seems to be fairly successful although I think that I have my Appium doctored with your patch so I'm not sure if it works with stock Appium. I'm not going to be able to check that until next week at the earliest. I built on Fedora 24 x64 and this is the rough path that I followed in case it is of use to anyone:

https://sites.google.com/a/chromium.org/chromedriver/contributing

https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md#Build-Chromium (*FOLLOW THESE )

sudo dnf install git python bzip2 tar pkgconfig atk-devel alsa-lib-devel bison binutils brlapi-devel bluez-libs-devel bzip2-devel cairo-devel cups-devel dbus-devel dbus-glib-devel expat-devel fontconfig-devel freetype-devel gcc-c++ GConf2-devel glib2-devel glibc.i686 gperf glib2-devel gtk2-devel gtk3-devel java-1.*.0-openjdk-devel libatomic libcap-devel libffi-devel libgcc.i686 libgnome-keyring-devel libjpeg-devel libstdc++.i686 libX11-devel libXScrnSaver-devel libXtst-devel libxkbcommon-x11-devel ncurses-compat-libs nspr-devel nss-devel pam-devel pango-devel pciutils-devel pulseaudio-libs-devel zlib.i686 httpd mod_ssl php php-cli python-psutil wdiff xfs

Also do these: http://www.fedorafaq.org/#installfonts

https://codereview.chromium.org/2375613002/#ps80001 ( THEN APPLY THESE as below to fix https://bugs.chromium.org/p/chromedriver/issues/detail?id=749)

cp chrome/test/chromedriver/chrome/adb.h chrome/test/chromedriver/chrome/adb.h.bak patch chrome/test/chromedriver/chrome/adb.h ~/Downloads/chromedriver_patches/issue2375613002_60001_70002.diff cp chrome/test/chromedriver/chrome/adb_impl.h chrome/test/chromedriver/chrome/adb_impl.h.bak patch chrome/test/chromedriver/chrome/adb_impl.h ~/Downloads/chromedriver_patches/issue2375613002_60001_70004.diff cp chrome/test/chromedriver/chrome/adb_impl.cc chrome/test/chromedriver/chrome/adb_impl.cc.bak patch chrome/test/chromedriver/chrome/adb_impl.cc ~/Downloads/chromedriver_patches/issue2375613002_60001_70003.diff cp chrome/test/chromedriver/chrome/device_manager.cc chrome/test/chromedriver/chrome/device_manager.cc.bak patch chrome/test/chromedriver/chrome/device_manager.cc ~/Downloads/chromedriver_patches/issue2375613002_60001_70005.diff cp chrome/test/chromedriver/chrome/device_manager_unittest.cc chrome/test/chromedriver/chrome/device_manager_unittest.cc.bak patch chrome/test/chromedriver/chrome/device_manager_unittest.cc ~/Downloads/chromedriver_patches/issue2375613002_60001_70006.diff

/Change build to non-component, non-debug build (so no extra linked libraries hanging around & size is reduced due to lack of debug) / run 'gn args out/Default' and add lines to resulting file that appears, save and exit:

is_debug = false is_component_build = false symbol_level = 0

/* compile/build chromedriver /

ninja -C out/Default chrome/test/chromedriver:chromedriver

Find output file at out/Default/chromedriver

Run appium/robot - note that some previous patches required "&{chromeOptions}= Create Dictionary androidDeviceSocket=com.lincor.medialinc_devtools_remote" line and the dictionary be added to chrome launch options. This is NOT required now

pandabat commented 7 years ago

This is the patched chromedriver x64 2.28 that seems to work for me on Fedora 24 x64

https://www.dropbox.com/s/605wm68iamhisqf/chromedriver_64_2.28_patched_xwalk?dl=0

letsrokk commented 7 years ago

@pandabat thanks for the info!

letsrokk commented 7 years ago

I might want to try and update patch to support 1.6.x when https://github.com/appium/appium-desktop is released

diemol commented 6 years ago

Hi all,

My apologies for hijacking this old thread.

Do you guys know if this is still the current status? We've been trying to automate an app based on cordova-plugin-crosswalk-webview 2.4.0, and when switching to WebView we were getting the same error (with older Appium/ChromeDriver versions) and a different one (Failed to start Chromedriver session: An unknown server-side error occurred while processing the command. (Original error: unknown error: Failed to get sockets matching: @webview_devtools_remote_.*3952 (make sure the app has its WebView configured for debugging).

The only thing very much related to what we have is this repo and the Appium issues that link to it. So is compiling our own ChromeDriver version with the fix still the solution?

letsrokk commented 6 years ago

hi @diemol,

As of right now, Appium has fixed issued on its side, but ChromeDriver part is still "in review"

See: https://github.com/appium/appium/issues/4597 and https://github.com/appium/appium-android-driver/pull/238

Patched version of ChromeDriver you can find here: https://github.com/blutter/appium-crosswalk-fix (binaries for macOS and Win). I tested this binaries on macOS with Appium 1.7.2 and it seems to work just fine!

letsrokk commented 6 years ago

Closing this issue. Patch for Appium is no longer needed (starting from 1.6.x), but patched ChomeDriver is still must. You can find links to patched ChromeDriver binaries for macOS and Windows in the comment above

pandabat commented 6 years ago

Chromedriver 2.38 patched for Linux x64 (built on Fedora 27 x64)

https://www.dropbox.com/s/9aaw8dsg913an13/chromedriver_64_2.38_patched_xwalk?dl=0

Seems to work well enough for us. Would be nice to have a properly integrated and supported fix on the Chromedriver side but, seeing as crosswalk usage is probably in decline these days, I'm not sure that that will ever happen

letsrokk commented 6 years ago

Thanks @pandabat !

Unfortunately, CrossWalk is not only in decline, but CrossWalk Project itself is closed and no longer supported - https://crosswalk-project.org/blog/crosswalk-final-release.html

diemol commented 6 years ago

@letsrokk @pandabat thanks a lot for the quick answer, this is really helpful!

I was not aware that CrossWalk is closed, that is a great input for us. We are helping a customer stuck in their automation precisely because of this issue, so it also makes sense that they take another approach to build their app.

diemol commented 6 years ago

@letsrokk, nevertheless, do you have a link to track the "but ChromeDriver part is still "in review"" part?

Again, thanks for your help.

letsrokk commented 6 years ago

@diemol here you can find proposed fix for ChromeDriver https://codereview.chromium.org/2375613002/

diemol commented 6 years ago

Hi all,

Just dropping by to thank you for all the help and sharing my findings since we had to recompile ChromeDriver 2.40 for a customer that is still using CrossWalk (but soon will move out of it).

Current patch that worked for us (in case someone is in the same situation):

diff --git a/chrome/test/chromedriver/chrome/device_manager.cc b/chrome/test/chromedriver/chrome/device_manager.cc
index 2558656d74..d8713d9859 100644
--- a/chrome/test/chromedriver/chrome/device_manager.cc
+++ b/chrome/test/chromedriver/chrome/device_manager.cc
@@ -159,10 +159,20 @@ Status Device::ForwardDevtoolsPort(const std::string& package,
     status = adb_->GetSocketByPattern(serial_, pattern, &socket_name);
     if (status.IsError()) {
       if (socket_name.empty())
+        LOG(WARNING) << "Webview with requited pattern webview_devtools_remote_ not found.";
+    }
+    LOG(WARNING) << "Will try to find a CrossWalk webview...";
+    std::string crosswalk_pattern =
+        base::StringPrintf("@%s_devtools_remote", package.c_str());
+    status = adb_->GetSocketByPattern(serial_, crosswalk_pattern, &socket_name);
+    if (status.IsError()) {
+      if (socket_name.empty()) {
         status.AddDetails(
             "make sure the app has its WebView configured for debugging");
+      }
       return status;
     }
+
     // When used in adb with "localabstract:", the leading '@' is not needed.
     *device_socket = socket_name.substr(1);
   }
diff --git a/chrome/test/chromedriver/chrome/navigation_tracker.cc b/chrome/test/chromedriver/chrome/navigation_tracker.cc
index b4c5b00ad3..7ba1ce3aa2 100644
--- a/chrome/test/chromedriver/chrome/navigation_tracker.cc
+++ b/chrome/test/chromedriver/chrome/navigation_tracker.cc
@@ -320,10 +320,10 @@ Status NavigationTracker::OnEvent(DevToolsClient* client,
     if (!params.GetInteger("context.id", &execution_context_id))
       return Status(kUnknownError, "missing or invalid 'context.id'");
     std::string frame_id;
-    if (!params.GetString("context.auxData.frameId", &frame_id)) {
-      return Status(kUnknownError,
-                    "missing or invalid 'context.auxData.frameId'");
-    }
+//    if (!params.GetString("context.auxData.frameId", &frame_id)) {
+//      return Status(kUnknownError,
+//                    "missing or invalid 'context.auxData.frameId'");
+//    }
     if (frame_id == dummy_frame_id_)
       dummy_execution_context_id_ = execution_context_id;
     else

and a Dockerfile to recompile ChromeDriver based on that patch, a binary for Linux is generated but the same principle can be followed for OSX and Windows

FROM ubuntu:16.04

# Install Chromium build dependencies.
RUN echo "deb http://archive.ubuntu.com/ubuntu trusty multiverse" >> /etc/apt/sources.list # && dpkg --add-architecture i386
RUN apt-get update && apt-get install -qy git build-essential clang curl lsb-release sudo

# Install Chromium's depot_tools.
ENV DEPOT_TOOLS /usr/bin/depot_tools
RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS
ENV PATH $PATH:$DEPOT_TOOLS
RUN echo -e "\n# Add Chromium's depot_tools to the PATH." >> .bashrc
RUN echo "export PATH=\"\$PATH:$DEPOT_TOOLS\"" >> .bashrc

RUN git config --global https.postBuffer 1048576000

# Download Chromium sources.
RUN fetch --nohooks --no-history chromium

WORKDIR /

RUN gclient runhooks

WORKDIR src

RUN build/install-build-deps.sh --no-prompt

COPY crosswalk.patch crosswalk.patch
RUN git apply crosswalk.patch

RUN gn gen out/Release --args="is_debug=false"
RUN ninja -C out/Release chromedriver

RUN cp out/Release/chromedriver /usr/bin/chromedriver
RUN /usr/bin/chromedriver --version

WORKDIR /
letsrokk commented 6 years ago

@diemol thank you very much, this is really helpful! I'll add it to repo description