Skip to content

Instantly share code, notes, and snippets.

View dpgraham's full-sized avatar

Dan Graham dpgraham

  • Sauce Labs (@appium Team)
  • Vancouver, BC, Canada
View GitHub Profile
The server is running
Start New SessionStop Server
[Appium] Welcome to Appium v1.6.4
[Appium] Non-default server args:
[Appium] port: 5723
[Appium] Appium REST http interface listener started on 0.0.0.0:5723
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/machan/WebstormProjects/myticketingtest/apps/myticketing_ui.app/","browserName":"","deviceName":"iPad Air","orientation":"","platformName":"iOS","platformVersion":"10.3","newCommandTimeout":0,"connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/machan/WebstormProjects/myticketingtest/apps/myticketing_ui.app/","browserName":"","deviceName":"iPad Air","orientation":"","platformName":"iOS","platformVersion":"10.3","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null,null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1496793747497 (10:02:27 GMT+1000 (AEST))
* Appium 1.8.0 will be the first version of Appium to _fully_ implement [W3C](https://github.com/jlipps/simple-wd-spec)
* 1.7.2 accepts W3C parameters during session creation but coerces them into a MJSONWP session
* The [W3C](https://github.com/jlipps/simple-wd-spec) simplified spec doc that JLipps wrote explains most of how the spec works
* This document will elaborate on how Appium implements this spec
## Session Creation
* When parameters are passed to the session creation endpoint (`POST /session`), Appium will parse the body and determine if it should start a W3C or MJSONWP Session
* If the body contains an object called `capabilities` it will be a W3C session
* Else if the body contains an object called `desiredCapabilities` it will be an MJSONWP session
* If both are provided, it will be a W3C session (NOTE: If anyone objects to this and feels that it should be MJSONWP, please let me know)
@dpgraham
dpgraham / gist:698b464a4cef376d6c2c93f0fdb00169
Last active June 28, 2018 16:47
Android Instant Apps
// Call the method
await driver.execute("mobile: deepLink", {url: 'https://www.realtor.com/realestateandhomes-search/San-Jose_CA', package: 'com.move.realtor'});
// If instant apps are enabled on this device, we should be able to switch
// to a native context and find elements
await driver.source().should.eventually.match(/com\.move\.realtor/);
// Check that we can find a native element and interact with it
const btn = await driver.elementsByXPath('//android.widget.Button');
btn.length.should.be.above(0);
info Espresso Android Espresso Driver listening on http://localhost:4884
info HTTP --> POST /wd/hub/session
info HTTP {"desiredCapabilities":{"app":"/Users/danielgraham/appium-android-driver/test/assets/ContactManager.apk","automationName":"UIAutomator2","deviceName":"Device","forceEspressoRebuild":true,"platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true}}
dbug MJSONWP Calling EspressoDriver.createSession() with args: [{"app":"/Users/danielgraham/appium-android-driver/test/assets/ContactManager.apk","automationName":"UIAutomator2","deviceName":"Device","forceEspressoRebuild":true,"platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
dbug BaseDriver Event 'newSessionRequested' logged at 1526319116655 (10:31:56 GMT-0700 (PDT))
dbug BaseDriver Creating session with MJSONWP desired capabilities: {"app":"/Users/danielgraham...
WARN BaseDriver The following capabilities were provided, but are not recognized by appium: connectHardwareKeyboard.
info BaseDr
05-17 23:24:03.329 11514 11540 I appium : channel read invoked!
05-17 23:24:03.330 11514 11540 I appium : channel read: GET /wd/hub/status
05-17 23:24:03.335 11514 11540 I appium : AppiumResponse: {"sessionId":"SESSIONID","status":0,"value":"Status Invoked"}
05-17 23:24:03.433 11514 11541 I appium : channel read invoked!
05-17 23:24:03.435 11514 11541 I appium : channel read: POST /wd/hub/session
05-17 23:24:03.453 11514 11541 D appium : payload: {"desiredCapabilities":{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"http://appium.github.io/appium/assets/ApiDemos-debug.apk","automationName":"UIAutomator2","deviceName":"Device","forceEspressoRebuild":false,"fullReset":true,"platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true},"app":"http://appium.github.io/appium/assets/ApiDemos-debug.apk","automationName":"UIAutomator
[Appium] Creating new AndroidUiautomator2Driver (v1.12.0) session
[Appium] Capabilities:
[Appium] app: http://appium.github.io/appium/assets/ApiDemos-debug.apk
[Appium] automationName: UIAutomator2
[Appium] deviceName: Device
[Appium] forceEspressoRebuild: false
[Appium] fullReset: true
[Appium] platformName: Android
[Appium] newCommandTimeout: 0
[Appium] connectHardwareKeyboard: true
05-24 23:44:12.783 10277 10277 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
05-24 23:44:12.792 10277 10277 W app_process: Could not reserve sentinel fault page
05-24 23:44:12.891 10277 10277 W app_process: Unexpected CPU variant for X86 using defaults: x86
05-24 23:44:12.893 10277 10277 I app_process: The ClassLoaderContext is a special shared library.
05-24 23:44:12.900 10277 10277 W app_process: CheckJNI: method to register "write" not in the given class. This is slow, consider changing your RegisterNatives calls.
05-24 23:44:12.901 10277 10277 I chatty : uid=2000(shell) main identical 42 lines
05-24 23:44:12.901 10277 10277 W app_process: CheckJNI: method to register "write" not in the given class. This is slow, consider changing your RegisterNatives calls.
05-24 23:44:12.901 10277 10277 W app_process: CheckJNI: method to register "write_non_chained" not in the given class. This is slow, consider changing your RegisterNatives calls.
05-24 23:44:12.901 10277 10277 I ch
05-25 03:47:00.575 6468 6468 E WorkController: Loading failed for worker [context]
05-25 03:47:00.575 6468 6468 E WorkController: java.lang.IllegalStateException: WorkerManager is disposed
05-25 03:47:00.575 6468 6468 E WorkController: at com.google.android.apps.gsa.search.core.service.f.b.c.hu(SourceFile:7)
05-25 03:47:00.575 6468 6468 E WorkController: at com.google.android.apps.gsa.search.core.service.workcontroller.a.d.run(Unknown Source:20)
05-25 03:47:00.575 6468 6468 E WorkController: at com.google.android.apps.gsa.shared.util.concurrent.b.bq.bfm(SourceFile:2)
05-25 03:47:00.575 6468 6468 E WorkController: at com.google.android.apps.gsa.shared.util.concurrent.b.bn.run(SourceFile:2)
05-25 03:47:00.575 6468 6468 E WorkController: at com.google.android.apps.gsa.shared.util.concurrent.au.run(SourceFile:5)
05-25 03:47:00.575 6468 6468 E WorkController: at android.os.Handler.handleCallback(Handler.java:873)
05-25 03:47:00.575 6468 6468 E WorkController: at android.os.Handler.dispatch
@dpgraham
dpgraham / gist:226d350edab528c19ff458a1d3f779f7
Created June 4, 2018 23:02
iPhone X - IOS 11: XCUITest Results
146 passing (52m)
21 pending
19 failing
1) XCUITestDriver - gestures dynamic gestures special actions should open the control center by swiping up at the bottom:
Error: [elementByAccessibilityId("ControlCenterView")] Error response status: 7, , NoSuchElement - An element could not be located on the page using the given search parameters. Selenium error: An element could not be located on the page using the given search parameters.
at exports.newError (node_modules/wd/lib/utils.js:148:13)
at node_modules/wd/lib/callbacks.js:94:19
at node_modules/wd/lib/webdriver.js:185:5
at Request._callback (node_modules/wd/lib/http-utils.js:89:7)
@dpgraham
dpgraham / gist:8b8584fd725d71561bde9e1ec863b237
Created June 7, 2018 20:45
Appium 1.8.0: moveTo Absolute to Relative Coordinates Change
* Appium 1.8.0 introduced a change to the way the `moveTo` touch events works
* Previously, `moveTo` treats coordinates as relative, now `moveTo` accepts coordinates
(in compliance with the spec)
Example
========================
* Python sample
```python