Appium uiautomator2 sendKeys method is very slowly - appium

sendKeys method fills the input field in about 3 minutes. Can the keyboard numeric opened in the application I use be related to this reason? Should I try another method?
Thanks for helps.
appium logs at wait time:
[debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Responding to client with driver.findElement() result: {“element-6066-11e4-a52e-4f735466cecf”:“00000000-0000-0007-ffff-ffff0000004b”,“ELEMENT”:“00000000-0000-0007-ffff-ffff0000004b”} [HTTP] <-- POST /session/cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff/element 200 10120 ms - 137 [HTTP] [HTTP] --> GET /session/cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff/element/00000000-0000-0007-ffff-ffff0000004b/displayed [HTTP] {} [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Calling AppiumDriver.elementDisplayed() with args: [“00000000-0000-0007-ffff-ffff0000004b”,“cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff”] [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Matched ‘/element/00000000-0000-0007-ffff-ffff0000004b/attribute/displayed’ to command name ‘getAttribute’ [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Proxying [GET /element/00000000-0000-0007-ffff-ffff0000004b/attribute/displayed] to [GET http://127.0.0.1:10005/session/c4daa156-880a-49c5-a742-b40744eb065c/element/00000000-0000-0007-ffff-ffff0000004b/attribute/displayed] with no body [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Got response with status 200: {“sessionId”:“c4daa156-880a-49c5-a742-b40744eb065c”,“value”:“true”} [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Responding to client with driver.elementDisplayed() result: true [HTTP] <-- GET /session/cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff/element/00000000-0000-0007-ffff-ffff0000004b/displayed 200 20262 ms - 14 [HTTP] [HTTP] --> GET /session/cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff/context [HTTP] {} [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Calling AppiumDriver.getCurrentContext() with args: [“cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff”] [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Responding to client with driver.getCurrentContext() result: “NATIVE_APP” [HTTP] <-- GET /session/cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff/context 200 1 ms - 22 [HTTP] [HTTP] --> POST /session/cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff/element [HTTP] {“using”:“id”,“value”:“com.a101.plus:id/et_phone”} [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Calling AppiumDriver.findElement() with args: [“id”,“com.a101.plus:id/et_phone”,“cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff”] [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Waiting up to 0 ms for condition [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Matched ‘/element’ to command name ‘findElement’ [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Proxying [POST /element] to [POST http://127.0.0.1:10005/session/c4daa156-880a-49c5-a742-b40744eb065c/element] with body: {“strategy”:“id”,“selector”:“com.a101.plus:id/et_phone”,“context”:"",“multiple”:false} [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Got response with status 200: {“sessionId”:“c4daa156-880a-49c5-a742-b40744eb065c”,“value”:{“ELEMENT”:“00000000-0000-0007-ffff-ffff0000004b”,“element-6066-11e4-a52e-4f735466cecf”:“00000000-0000-0007-ffff-ffff0000004b”}} [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Responding to client with driver.findElement() result: {“element-6066-11e4-a52e-4f735466cecf”:“00000000-0000-0007-ffff-ffff0000004b”,“ELEMENT”:“00000000-0000-0007-ffff-ffff0000004b”} [HTTP] <-- POST /session/cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff/element 200 10160 ms - 137 [HTTP] [HTTP] --> POST /session/cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff/element/00000000-0000-0007-ffff-ffff0000004b/value [HTTP] {“id”:“00000000-0000-0007-ffff-ffff0000004b”,“text”:“login with 5419107181”,“value”:[“l”,“o”,“g”,“i”,“n”," “,“w”,“i”,“t”,“h”,” “,“5”,“4”,“1”,“9”,“1”,“0”,“7”,“1”,“8”,“1”]} [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Calling AppiumDriver.setValue() with args: [[“l”,“o”,“g”,“i”,“n”,” “,“w”,“i”,“t”,“h”,” “,“5”,“4”,“1”,“9”,“1”,“0”,“7”,“1”,“8”,“1”],“00000000-0000-0007-ffff-ffff0000004b”,“cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff”] [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Matched ‘/element/00000000-0000-0007-ffff-ffff0000004b/value’ to command name ‘setValue’ [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Added ‘value’ property [“l”,“o”,“g”,“i”,“n”,” “,“w”,“i”,“t”,“h”,” “,“5”,“4”,“1”,“9”,“1”,“0”,“7”,“1”,“8”,“1”] to ‘setValue’ request body [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Proxying [POST /element/00000000-0000-0007-ffff-ffff0000004b/value] to [POST http://127.0.0.1:10005/session/c4daa156-880a-49c5-a742-b40744eb065c/element/00000000-0000-0007-ffff-ffff0000004b/value] with body: {“elementId”:“00000000-0000-0007-ffff-ffff0000004b”,“text”:“login with 5419107181”,“replace”:false,“value”:[“l”,“o”,“g”,“i”,“n”,” “,“w”,“i”,“t”,“h”,” ",“5”,“4”,“1”,“9”,“1”,“0”,“7”,“1”,“8”,“1”]} [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Got response with status 200: {“sessionId”:“c4daa156-880a-49c5-a742-b40744eb065c”,“value”:null} [debug] [AndroidUiautomator2Driver#762c (cbf9c9c1)] Responding to client with driver.setValue() result: null [HTTP] <-- POST /session/cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff/element/00000000-0000-0007-ffff-ffff0000004b/value 200 60684 ms - 14 [HTTP] [HTTP] --> POST /session/cbf9c9c1-9b29-4ecc-81f7-bc1d4fed6aff/appium/stop_recording_screen

Related

Appium Inspector Not Working Unable to inspect the element in ios 15.3.1

Iam using xcode v-13.2 appium version 1.21.0 and iPhone XR v-15.3.1 not able to open appium inspector pls help!!!!
terminal code-
Last login: Fri Feb 25 01:09:02 on ttys000
taniya#Anus-MacBook ~ % cd /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent
taniya#Anus-MacBook appium-webdriveragent % xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id='00008020-000E08901EF9002E' test -allowProvisioningUpdates
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=00008020-000E08901EF9002E test -allowProvisioningUpdates
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
2022-02-25 01:13:10.330 xcodebuild[9152:471315] CFURLRequestSetHTTPCookieStorageAcceptPolicy_block_invoke: no longer implemented and should not be called
note: Using new build system
note: Planning
Analyze workspace
Create build description
Build description signature: 41cbaf1fe2310278fb3c9a049f6b7dc8
Build description path: /Users/Taniya/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Build/Intermediates.noindex/XCBuildData/41cbaf1fe2310278fb3c9a049f6b7dc8-desc.xcbuild
note: Build preparation complete
note: Building targets in dependency order
Testing started
2022-02-25 01:13:13.528951+0530 WebDriverAgentRunner-Runner[1296:487378] Running tests...
Test Suite 'All tests' started at 2022-02-25 01:13:13.949
Test Suite 'WebDriverAgentRunner.xctest' started at 2022-02-25 01:13:13.949
Test Suite 'UITestingUITests' started at 2022-02-25 01:13:13.950
t = nans Suite Set Up
2022-02-25 01:13:13.981084+0530 WebDriverAgentRunner-Runner[1296:487378] [User Defaults] Couldn't write values for keys (
KeyboardAutocorrection
) in CFPrefsPlistSource<0x280582a00> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-02-25 01:13:13.981636+0530 WebDriverAgentRunner-Runner[1296:487378] [User Defaults] Couldn't write values for keys (
"KeyboardAutocorrection_changedAt"
) in CFPrefsPlistSource<0x280582a00> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-02-25 01:13:13.982059+0530 WebDriverAgentRunner-Runner[1296:487378] [User Defaults] Couldn't write values for keys (
"KeyboardAutocorrection_buildAtChange"
) in CFPrefsPlistSource<0x280582a00> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-02-25 01:13:13.982425+0530 WebDriverAgentRunner-Runner[1296:487378] [User Defaults] Couldn't write values for keys (
"KeyboardAutocorrection_previousValue"
) in CFPrefsPlistSource<0x280582a00> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-02-25 01:13:13.982751+0530 WebDriverAgentRunner-Runner[1296:487378] [User Defaults] Couldn't write values for keys (
"KeyboardAutocorrection_analyzedAt"
) in CFPrefsPlistSource<0x280582a00> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-02-25 01:13:13.990357+0530 WebDriverAgentRunner-Runner[1296:487378] [User Defaults] Couldn't write values for keys (
KeyboardPrediction
) in CFPrefsPlistSource<0x280582a00> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-02-25 01:13:13.990775+0530 WebDriverAgentRunner-Runner[1296:487378] [User Defaults] Couldn't write values for keys (
KeyboardShowPredictionBar
) in CFPrefsPlistSource<0x280582a00> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-02-25 01:13:13.991318+0530 WebDriverAgentRunner-Runner[1296:487378] [User Defaults] Couldn't write values for keys (
DidShowGestureKeyboardIntroduction
) in CFPrefsPlistSource<0x280582a00> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
Test Case '-[UITestingUITests testRunner]' started.
t = 0.00s Start Test at 2022-02-25 01:13:13.992
t = 0.00s Set Up
2022-02-25 01:13:13.993946+0530 WebDriverAgentRunner-Runner[1296:487378] Built at Feb 25 2022 01:09:15
2022-02-25 01:13:14.009294+0530 WebDriverAgentRunner-Runner[1296:487378] ServerURLHere->http://192.168.101.4:8100<-ServerURLHere
2022-02-25 01:13:14.010070+0530 WebDriverAgentRunner-Runner[1296:487639] Using singleton test manager
2022-02-25 01:18:25.473278+0530 WebDriverAgentRunner-Runner[1296:487378] Getting the most recent active application (out of 1 total items)
t = 311.50s Find the Application 'com.apple.springboard'
t = 311.51s Requesting snapshot of accessibility hierarchy for app with pid 63
2022-02-25 01:18:26.519103+0530 WebDriverAgentRunner-Runner[1296:487378] Getting the most recent active application (out of 1 total items)
t = 312.53s Find the Application 'com.apple.springboard'
t = 312.53s Requesting snapshot of accessibility hierarchy for app with pid 63
2022-02-25 01:18:26.656315+0530 WebDriverAgentRunner-Runner[1296:487378] Getting the most recent active application (out of 1 total items)
t = 312.67s Get all elements bound by accessibility element for: Descendants matching type StatusBar
t = 312.67s Requesting snapshot of accessibility hierarchy for app with pid 63
t = 312.77s Find: Descendants matching type StatusBar
t = 312.78s Checking existence of `StatusBar`
t = 312.78s Requesting snapshot of accessibility hierarchy for app with pid 63
t = 312.87s Find: Descendants matching type StatusBar
t = 312.87s Find: Identity Binding
t = 312.87s Find the StatusBar
t = 312.88s Requesting snapshot of accessibility hierarchy for app with pid 63
t = 312.96s Find: Descendants matching type StatusBar
t = 312.96s Find: Identity Binding
2022-02-25 01:18:26.974700+0530 WebDriverAgentRunner-Runner[1296:487378] Getting the most recent active application (out of 1 total items)
t = 312.98s Requesting snapshot of accessibility hierarchy for app with pid 63
2022-02-25 01:18:27.074784+0530 WebDriverAgentRunner-Runner[1296:487378] Getting the most recent active application (out of 1 total items)
2022-02-25 01:18:27.087328+0530 WebDriverAgentRunner-Runner[1296:487378] Getting the most recent active application (out of 1 total items)
t = 313.10s Requesting snapshot of accessibility hierarchy for app with pid 63
2022-02-25 01:18:27.191684+0530 WebDriverAgentRunner-Runner[1296:487378] Getting the most recent active application (out of 1 total items)
2022-02-25 01:18:27.217950+0530 WebDriverAgentRunner-Runner[1296:487378] Getting the most recent active application (out of 1 total items)
2022-02-25 01:18:27.221305+0530 WebDriverAgentRunner-Runner[1296:487378] The following attributes were requested to be included into the XML: {(
FBNameAttribute,
FBHeightAttribute,
FBAccessibleAttribute,
FBValueAttribute,
FBVisibleAttribute,
FBWidthAttribute,
FBEnabledAttribute,
FBTypeAttribute,
FBYAttribute,
FBLabelAttribute,
FBIndexAttribute,
FBXAttribute
)}
2022-02-25 01:18:27.221497+0530 WebDriverAgentRunner-Runner[1296:487378] Waiting up to 2s until com.apple.springboard is in idle state (including animations)
t = 313.23s Wait for com.apple.springboard to idle
t = 313.23s Requesting snapshot of accessibility hierarchy for app with pid 63
attaching images of iphone,appium,and inspector-
[enter image description here][1]
[1]: https://i.stack.imgur.com/cz58Y.png
appium code-
The server is running
[Appium] Welcome to Appium v1.21.0
[Appium] Non-default server args:
[Appium] relaxedSecurityEnabled: true
[Appium] allowInsecure: {
[Appium] }
[Appium] denyInsecure: {
[Appium] }
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> GET /wd/hub/sessions
[HTTP] {}
[GENERIC] Calling AppiumDriver.getSessions() with args: []
[GENERIC] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 5 ms - 40
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"NoReset":true,"autoLaunch":false,"automationName":"XCUITest","bundleId":"com.mcdonalds.gma.Arch","deviceName":"iPhone XR","fullReset":false,"platformName":"iOS","platformVersion":"14.7","udid":"00008020-000E08901EF9002E","newCommandTimeout":0,"connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"NoReset":true,"autoLaunch":false,"automationName":"XCUITest","bundleId":"com.mcdonalds.gma.Arch","deviceName":"iPhone XR","fullReset":false,"platformName":"iOS","platformVersion":"14.7","udid":"00008020-000E08901EF9002E","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1645732104338 (01:18:24 GMT+0530 (India Standard Time))
[Appium] Appium v1.21.0 creating new XCUITestDriver (v3.43.0) session
[Appium] Applying relaxed security to 'XCUITestDriver' as per server command line argument. All insecure features will be enabled unless explicitly disabled by --deny-insecure
[BaseDriver] Creating session with MJSONWP desired capabilities: {
[BaseDriver] "NoReset": true,
[BaseDriver] "autoLaunch": false,
[BaseDriver] "automationName": "XCUITest",
[BaseDriver] "bundleId": "com.mcdonalds.gma.Arch",
[BaseDriver] "deviceName": "iPhone XR",
[BaseDriver] "fullReset": false,
[BaseDriver] "platformName": "iOS",
[BaseDriver] "platformVersion": "14.7",
[BaseDriver] "udid": "00008020-000E08901EF9002E",
[BaseDriver] "newCommandTimeout": 0,
[BaseDriver] "connectHardwareKeyboard": true
[BaseDriver] }
[BaseDriver] The following capabilities were provided, but are not recognized by Appium:
[BaseDriver] NoReset
[BaseDriver] Session created with session id: f3731b63-8e2e-4be1-9c50-3f5774a79856
[XCUITest] Current user: 'taniya'
[XCUITest] Available devices: 00008020-000E08901EF9002E
[XCUITest] Creating iDevice object with udid '00008020-000E08901EF9002E'
[XCUITest] Determining device to run tests on: udid: '00008020-000E08901EF9002E', real device: true
[BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1645732105240 (01:18:25 GMT+0530 (India Standard Time))
[BaseDriver] Event 'appConfigured' logged at 1645732105241 (01:18:25 GMT+0530 (India Standard Time))
[BaseDriver] Event 'resetStarted' logged at 1645732105241 (01:18:25 GMT+0530 (India Standard Time))
[XCUITest] Reset: running ios real device reset flow
[BaseDriver] Event 'resetComplete' logged at 1645732105241 (01:18:25 GMT+0530 (India Standard Time))
[WebDriverAgent] Using WDA path: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent'
[WebDriverAgent] Using WDA agent: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
[XCUITest] Crash reports root '/Users/Taniya/Library/Logs/CrashReporter/MobileDevice/Anu’s iPhone' does not exist. Got nothing to gather.
[BaseDriver] Event 'logCaptureStarted' logged at 1645732105481 (01:18:25 GMT+0530 (India Standard Time))
[XCUITest] Setting up real device
[WebDriverAgent] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[DevCon Factory] Requesting connection for device 00008020-000E08901EF9002E on local port 8100, device port 8100
[DevCon Factory] Cached connections count: 0
[DevCon Factory] Successfully requested the connection for 00008020-000E08901EF9002E:8100
[XCUITest] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] Got response with status 200: {"value":{"message":"WebDriverAgent is ready to accept commands","state":"success","os":{"testmanagerdVersion":28,"name":"iOS","sdkVersion":"15.2","version":"15.3.1"},"ios":{"ip":"192.168.101.4"},"ready":true,"build":{"time":"Feb 25 2022 01:09:15","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"}},"sessionId":null}
[WebDriverAgent] Upgrade timestamp of the currently bundled WDA: 1620631774000
[WebDriverAgent] Upgrade timestamp of the WDA on the device: undefined
[WebDriverAgent] Will reuse previously cached WDA instance at 'http://127.0.0.1:8100/' with 'com.facebook.WebDriverAgentRunner'. Set the wdaLocalPort capability to a value different from 8100 if this is an undesired behavior.
[XCUITest] Trying to start WebDriverAgent 1 times with 10000ms interval
[XCUITest] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities
[BaseDriver] Event 'wdaStartAttempted' logged at 1645732105769 (01:18:25 GMT+0530 (India Standard Time))
[WebDriverAgent] Using provided WebdriverAgent at 'http://127.0.0.1:8100/'
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] Got response with status 200: {"value":{"message":"WebDriverAgent is ready to accept commands","state":"success","os":{"testmanagerdVersion":28,"name":"iOS","sdkVersion":"15.2","version":"15.3.1"},"ios":{"ip":"192.168.101.4"},"ready":true,"build":{"time":"Feb 25 2022 01:09:15","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"}},"sessionId":null}
[BaseDriver] Event 'wdaSessionAttempted' logged at 1645732105781 (01:18:25 GMT+0530 (India Standard Time))
[XCUITest] Sending createSession command to WDA
[WD Proxy] Matched '/session' to command name 'createSession'
[WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8100/session] with body: {"capabilities":{"firstMatch":[{"arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true,"shouldTerminateApp":true}],"alwaysMatch":{}}}
[WD Proxy] Got response with status 200: {"value":{"sessionId":"AB8BF474-27EB-4C78-978E-83EBBAC4F189","capabilities":{"device":"iphone","browserName":" ","sdkVersion":"15.3.1","CFBundleIdentifier":"com.apple.springboard"}},"sessionId":"AB8BF474-27EB-4C78-978E-83EBBAC4F189"}
[WD Proxy] Determined the downstream protocol as 'W3C'
[BaseDriver] Event 'wdaSessionStarted' logged at 1645732105983 (01:18:25 GMT+0530 (India Standard Time))
[BaseDriver] Event 'wdaStarted' logged at 1645732105983 (01:18:25 GMT+0530 (India Standard Time))
[XCUITest] Skipping setting of the initial display orientation. Set the "orientation" capability to either "LANDSCAPE" or "PORTRAIT", if this is an undesired behavior.
[BaseDriver] Event 'orientationSet' logged at 1645732105984 (01:18:25 GMT+0530 (India Standard Time))
[BaseDriver] The value of 'elementResponseAttributes' setting did not change. Skipping the update for it
[BaseDriver] The value of 'shouldUseCompactResponses' setting did not change. Skipping the update for it
[Appium] New XCUITestDriver session created successfully, session f3731b63-8e2e-4be1-9c50-3f5774a79856 added to master session list
[BaseDriver] Event 'newSessionStarted' logged at 1645732105985 (01:18:25 GMT+0530 (India Standard Time))
[MJSONWP (f3731b63)] Cached the protocol value 'MJSONWP' for the new session f3731b63-8e2e-4be1-9c50-3f5774a79856
[MJSONWP (f3731b63)] Responding to client with driver.createSession() result: {"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"NoReset":true,"autoLaunch":false,"automationName":"XCUITest","bundleId":"com.mcdonalds.gma.Arch","deviceName":"iPhone XR","fullReset":false,"platformName":"iOS","platformVersion":"14.7","udid":"00008020-000E08901EF9002E","newCommandTimeout":0,"connectHardwareKeyboard":true}
[HTTP] <-- POST /wd/hub/session 200 1648 ms - 544
[HTTP]
[HTTP] --> GET /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856/contexts
[HTTP] {}
[MJSONWP (f3731b63)] Calling AppiumDriver.getContexts() with args: ["f3731b63-8e2e-4be1-9c50-3f5774a79856"]
[XCUITest] Executing command 'getContexts'
[XCUITest] Getting list of available contexts
[iOS] Retrieving contexts and views
[XCUITest] Selecting by url: false
[RemoteDebugger] Remote Debugger version 8.13.2
[RemoteDebugger] useNewSafari --> false
[RemoteDebugger] Checking which communication style to use (non-Safari on platform version '14.7')
[RemoteDebugger] Platform version equal or higher than '12.2': true
[RemoteDebugger] Setting communication protocol: using Target-based communication
[RemoteDebugger] Sending connection key request
[RemoteDebugger] Sending '_rpc_reportIdentifier:' message (id: 0): 'setConnectionKey'
[RemoteDebugger] Sending to Web Inspector took 3ms
[RemoteDebugger] Sending connection key request
[RemoteDebugger] Sending '_rpc_reportIdentifier:' message (id: 2): 'setConnectionKey'
[RemoteDebugger] Sending to Web Inspector took 3ms
[RemoteDebugger] Selecting application
[RemoteDebugger] No applications currently connected.
[XCUITest] No web frames found.
[MJSONWP (f3731b63)] Responding to client with driver.getContexts() result: ["NATIVE_APP"]
[HTTP] <-- GET /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856/contexts 200 186 ms - 86
[HTTP]
[HTTP] --> GET /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856/context
[HTTP] {}
[MJSONWP (f3731b63)] Calling AppiumDriver.getCurrentContext() with args: ["f3731b63-8e2e-4be1-9c50-3f5774a79856"]
[XCUITest] Executing command 'getCurrentContext'
[MJSONWP (f3731b63)] Responding to client with driver.getCurrentContext() result: "NATIVE_APP"
[HTTP] <-- GET /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856/context 200 2 ms - 84
[HTTP]
[HTTP] --> GET /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856
[HTTP] {}
[MJSONWP (f3731b63)] Calling AppiumDriver.getSession() with args: ["f3731b63-8e2e-4be1-9c50-3f5774a79856"]
[XCUITest] Executing command 'getSession'
[WD Proxy] Matched '/' to command name 'getSession'
[WD Proxy] Proxying [GET /] to [GET http://127.0.0.1:8100/session/AB8BF474-27EB-4C78-978E-83EBBAC4F189] with no body
[WD Proxy] Got response with status 200: {"value":{"sessionId":"AB8BF474-27EB-4C78-978E-83EBBAC4F189","capabilities":{"device":"iphone","browserName":" ","sdkVersion":"15.3.1","CFBundleIdentifier":"com.apple.springboard"}},"sessionId":"AB8BF474-27EB-4C78-978E-83EBBAC4F189"}
[WD Proxy] Proxying [GET /wda/screen] to [GET http://127.0.0.1:8100/session/AB8BF474-27EB-4C78-978E-83EBBAC4F189/wda/screen] with no body
[WD Proxy] Got response with status 200: {"value":{"statusBarSize":{"width":414,"height":48},"scale":2},"sessionId":"AB8BF474-27EB-4C78-978E-83EBBAC4F189"}
[WD Proxy] Proxying [GET /window/size] to [GET http://127.0.0.1:8100/session/AB8BF474-27EB-4C78-978E-83EBBAC4F189/window/size] with no body
[WD Proxy] Got response with status 200: {"value":{"width":414,"height":896},"sessionId":"AB8BF474-27EB-4C78-978E-83EBBAC4F189"}
[XCUITest] Merging WDA caps over Appium caps for session detail response
[MJSONWP (f3731b63)] Responding to client with driver.getSession() result: {"udid":"00008020-000E08901EF9002E","NoReset":true,"autoLaunch":false,"automationName":"XCUITest","bundleId":"com.mcdonalds.gma.Arch","deviceName":"iPhone XR","fullReset":false,"platformName":"iOS","platformVersion":"14.7","newCommandTimeout":0,"connectHardwareKeyboard":true,"device":"iphone","browserName":" ","sdkVersion":"15.3.1","CFBundleIdentifier":"com.apple.springboard","pixelRatio":2,"statBarHeight":48,"viewportRect":{"left":0,"top":96,"width":828,"height":1696}}
[HTTP] <-- GET /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856 200 582 ms - 546
[HTTP]
[HTTP] --> GET /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856/window/current/size
[HTTP] {}
[MJSONWP (f3731b63)] Calling AppiumDriver.getWindowSize() with args: ["current","f3731b63-8e2e-4be1-9c50-3f5774a79856"]
[XCUITest] Executing command 'getWindowSize'
[WD Proxy] Proxying [GET /window/size] to [GET http://127.0.0.1:8100/session/AB8BF474-27EB-4C78-978E-83EBBAC4F189/window/size] with no body
[WD Proxy] Got response with status 200: {"value":{"width":414,"height":896},"sessionId":"AB8BF474-27EB-4C78-978E-83EBBAC4F189"}
[MJSONWP (f3731b63)] Responding to client with driver.getWindowSize() result: {"width":414,"height":896}
[HTTP] <-- GET /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856/window/current/size 200 117 ms - 98
[HTTP]
[HTTP] --> POST /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856/execute
[HTTP] {"script":"mobile:getContexts","args":[]}
[MJSONWP (f3731b63)] Calling AppiumDriver.execute() with args: ["mobile:getContexts",[],"f3731b63-8e2e-4be1-9c50-3f5774a79856"]
[XCUITest] Executing command 'execute'
[XCUITest] Getting list of available contexts
[iOS] Retrieving contexts and views
[XCUITest] Selecting by url: false
[RemoteDebugger] Sending connection key request
[RemoteDebugger] Sending '_rpc_reportIdentifier:' message (id: 4): 'setConnectionKey'
[RemoteDebugger] Sending to Web Inspector took 1ms
[RemoteDebugger] Selecting application
[RemoteDebugger] No applications currently connected.
[XCUITest] No web frames found.
[XCUITest] No webviews found in 1ms
[MJSONWP (f3731b63)] Responding to client with driver.execute() result: [{"id":"NATIVE_APP"}]
[HTTP] <-- POST /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856/execute 200 3 ms - 93
[HTTP]
[HTTP] --> GET /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856/source
[HTTP] {}
[MJSONWP (f3731b63)] Calling AppiumDriver.getPageSource() with args: ["f3731b63-8e2e-4be1-9c50-3f5774a79856"]
[XCUITest] Executing command 'getPageSource'
[WD Proxy] Matched '/source' to command name 'getPageSource'
[WD Proxy] Proxying [GET /source] to [GET http://127.0.0.1:8100/session/AB8BF474-27EB-4C78-978E-83EBBAC4F189/source] with no body
[WebDriverAgent] Parsed BUILD_DIR configuration value: '/Users/Taniya/Library/Developer/Xcode/DerivedData/WebDriverAgent-alwvnomvwrdtzoaxbbkniqrpcdpp/Build/Products'
[WebDriverAgent] Got derived data root: '/Users/Taniya/Library/Developer/Xcode/DerivedData/WebDriverAgent-alwvnomvwrdtzoaxbbkniqrpcdpp'
[WD Proxy] Got response with status 200: {"value":"\n\n \n \n \n \n \n \n
[MJSONWP (f3731b63)] Responding to client with driver.getPageSource() result: "\n \n \n \n \n \n \n
[HTTP] <-- GET /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856/source 200 1759 ms - 20029
[HTTP]
[HTTP] --> GET /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856/screenshot
[HTTP] {}
[MJSONWP (f3731b63)] Calling AppiumDriver.getScreenshot() with args: ["f3731b63-8e2e-4be1-9c50-3f5774a79856"]
[XCUITest] Executing command 'getScreenshot'
[XCUITest] Taking screenshot with WDA
[WD Proxy] Matched '/screenshot' to command name 'getScreenshot'
[WD Proxy] Proxying [GET /screenshot] to [GET http://127.0.0.1:8100/session/AB8BF474-27EB-4C78-978E-83EBBAC4F189/screenshot] with no body
[WD Proxy] Got response with status 500: {"value":{"error":"unable to capture screen","message":"A screen capture was made impossible","traceback":""},"sessionId":"AB8BF474-27EB-4C78-978E-83EBBAC4F189"}
[W3C] Matched W3C error code 'unable to capture screen' to UnableToCaptureScreen
[XCUITest] Error getting screenshot: A screen capture was made impossible
[XCUITest] Taking screenshot with WDA
[WD Proxy] Matched '/screenshot' to command name 'getScreenshot'
[WD Proxy] Proxying [GET /screenshot] to [GET http://127.0.0.1:8100/session/AB8BF474-27EB-4C78-978E-83EBBAC4F189/screenshot] with no body
[WD Proxy] Got response with status 500: {"value":{"error":"unable to capture screen","message":"A screen capture was made impossible","traceback":""},"sessionId":"AB8BF474-27EB-4C78-978E-83EBBAC4F189"}
[W3C] Matched W3C error code 'unable to capture screen' to UnableToCaptureScreen
[XCUITest] Taking screenshot with WDA
[WD Proxy] Matched '/screenshot' to command name 'getScreenshot'
[WD Proxy] Proxying [GET /screenshot] to [GET http://127.0.0.1:8100/session/AB8BF474-27EB-4C78-978E-83EBBAC4F189/screenshot] with no body
[WD Proxy] Got response with status 500: {"value":{"error":"unable to capture screen","message":"A screen capture was made impossible","traceback":""},"sessionId":"AB8BF474-27EB-4C78-978E-83EBBAC4F189"}
[W3C] Matched W3C error code 'unable to capture screen' to UnableToCaptureScreen
[MJSONWP (f3731b63)] Encountered internal error running command: UnableToCaptureScreen: A screen capture was made impossible
[MJSONWP (f3731b63)] at errorFromW3CJsonCode (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:780:25)
[MJSONWP (f3731b63)] at ProxyRequestError.getActualError (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:663:14)
[MJSONWP (f3731b63)] at JWProxy.command (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:272:19)
[MJSONWP (f3731b63)] at runMicrotasks ()
[MJSONWP (f3731b63)] at processTicksAndRejections (internal/process/task_queues.js:85:5)
[HTTP] <-- GET /wd/hub/session/f3731b63-8e2e-4be1-9c50-3f5774a79856/screenshot 500 1043 ms - 123
[HTTP]
pls help

XCUITest does not repeat same element click with Appium and iOS

I am using Eclipse, Appium, and a virtual iPhone device to attempt to automate a user registration on an app. However, clicking the same element 2 times in the same session results in the 2nd or more clicks to be ignored or unsuccessful. As far as I can tell, Appium is not throwing any errors. The test ins to type to a pin code display to input 10 numbers.
I have confirmed that every element works if none of the numbers are repeated. If any of the numbers are repeated, the click submitted to the device.
I have also confirmed that by doing this test manually under the same conditions, I am able to repeat pressing the same number button as many times as I want without issue. All clicks are registered.
Changing the pause doesn't matter. I have changed it to be up to 5 seconds per click. Speed of clicks doesn't seem to be the issue. Neither does the type of element being used. I also tried this with XCode.
This is my simple test to register to a service using a fixed code.
public static void RegisterUser() {
//Click the register button.
driver.findElement(By.id("registerButton")).click();
//Enter Reg Code.
ClickButton("**/XCUIElementTypeStaticText[`label == \"9\"`]");
ClickButton("**/XCUIElementTypeStaticText[`label == \"9\"`]");
ClickButton("**/XCUIElementTypeStaticText[`label == \"1\"`]");
ClickButton("**/XCUIElementTypeStaticText[`label == \"9\"`]");
ClickButton("**/XCUIElementTypeStaticText[`label == \"3\"`]");
ClickButton("**/XCUIElementTypeStaticText[`label == \"1\"`]");
ClickButton("**/XCUIElementTypeStaticText[`label == \"6\"`]");
ClickButton("**/XCUIElementTypeStaticText[`label == \"6\"`]");
ClickButton("**/XCUIElementTypeStaticText[`label == \"7\"`]");
ClickButton("**/XCUIElementTypeStaticText[`label == \"0\"`]");
}
//Click the target and wait half a second.
public static void ClickButton(String element) {
driver.findElement(MobileBy.iOSClassChain(element)).click();
Pause(100);
}
//Pause the current thread.
public static void Pause(int pauseTime) {
try {
Thread.sleep(pauseTime);
}
catch(InterruptedException e) {
e.printStackTrace();
e.getMessage();
e.getCause();
}
}
This is the output from Appium for the 2 clicks on the same element.
This one results in a successful click.
[HTTP] {"using":"-ios class chain","value":"**/XCUIElementTypeStaticText[`label == \"9\"`]"}
[debug] [W3C (47290369)] Calling AppiumDriver.findElement() with args: ["-ios class chain","**/XCUIElementTypeStaticText[`label == \"9\"`]","47290369-1558-4bae-98f7-ab0a3d0dc031"]
[debug] [XCUITest] Executing command 'findElement'
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id, css selector
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [XCUITest] Setting custom timeout to 12000 ms for 'findElement' command
[debug] [WD Proxy] Matched '/element' to command name 'findElement'
[debug] [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:8100/session/7C394CAB-D8A7-4977-A463-97BE23B2671B/element] with body: {"using":"class chain","value":"**/XCUIElementTypeStaticText[`label == \"9\"`]"}
[debug] [WD Proxy] Got response with status 200: {"value":{"ELEMENT":"6A000000-0000-0000-7205-010000000000","element-6066-11e4-a52e-4f735466cecf":"6A000000-0000-0000-7205-010000000000"},"sessionId":"7C394CAB-D8A7-4977-A463-97BE23B2671B"}
[debug] [W3C (47290369)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"6A000000-0000-0000-7205-010000000000","ELEMENT":"6A000000-0000-0000-7205-010000000000"}
[HTTP] <-- POST /wd/hub/session/47290369-1558-4bae-98f7-ab0a3d0dc031/element 200 92 ms - 137
[HTTP]
[HTTP] --> POST /wd/hub/session/47290369-1558-4bae-98f7-ab0a3d0dc031/element/6A000000-0000-0000-7205-010000000000/click
[HTTP] {"id":"6A000000-0000-0000-7205-010000000000"}
[W3C (47290369)] Driver proxy active, passing request on via HTTP proxy
[debug] [XCUITest] Executing command 'proxyReqRes'
[debug] [WD Proxy] Matched '/wd/hub/session/47290369-1558-4bae-98f7-ab0a3d0dc031/element/6A000000-0000-0000-7205-010000000000/click' to command name 'click'
[debug] [WD Proxy] Proxying [POST /wd/hub/session/47290369-1558-4bae-98f7-ab0a3d0dc031/element/6A000000-0000-0000-7205-010000000000/click] to [POST http://127.0.0.1:8100/session/7C394CAB-D8A7-4977-A463-97BE23B2671B/element/6A000000-0000-0000-7205-010000000000/click] with body: {"id":"6A000000-0000-0000-7205-010000000000"}
[debug] [WD Proxy] Got response with status 200: {"value":null,"sessionId":"7C394CAB-D8A7-4977-A463-97BE23B2671B"}
[WD Proxy] Replacing sessionId 7C394CAB-D8A7-4977-A463-97BE23B2671B with 47290369-1558-4bae-98f7-ab0a3d0dc031
[HTTP] <-- POST /wd/hub/session/47290369-1558-4bae-98f7-ab0a3d0dc031/element/6A000000-0000-0000-7205-010000000000/click 200 165 ms - 65
This one does not actually result in a click. But Appium thinks it does.
[HTTP] {"using":"-ios class chain","value":"**/XCUIElementTypeStaticText[`label == \"9\"`]"}
[debug] [W3C (47290369)] Calling AppiumDriver.findElement() with args: ["-ios class chain","**/XCUIElementTypeStaticText[`label == \"9\"`]","47290369-1558-4bae-98f7-ab0a3d0dc031"]
[debug] [XCUITest] Executing command 'findElement'
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id, css selector
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [XCUITest] Setting custom timeout to 12000 ms for 'findElement' command
[debug] [WD Proxy] Matched '/element' to command name 'findElement'
[debug] [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:8100/session/7C394CAB-D8A7-4977-A463-97BE23B2671B/element] with body: {"using":"class chain","value":"**/XCUIElementTypeStaticText[`label == \"9\"`]"}
[debug] [WD Proxy] Got response with status 200: {"value":{"ELEMENT":"6E000000-0000-0000-7205-010000000000","element-6066-11e4-a52e-4f735466cecf":"6E000000-0000-0000-7205-010000000000"},"sessionId":"7C394CAB-D8A7-4977-A463-97BE23B2671B"}
[debug] [W3C (47290369)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"6E000000-0000-0000-7205-010000000000","ELEMENT":"6E000000-0000-0000-7205-010000000000"}
[HTTP] <-- POST /wd/hub/session/47290369-1558-4bae-98f7-ab0a3d0dc031/element 200 103 ms - 137
[HTTP]
[HTTP] --> POST /wd/hub/session/47290369-1558-4bae-98f7-ab0a3d0dc031/element/6E000000-0000-0000-7205-010000000000/click
[HTTP] {"id":"6E000000-0000-0000-7205-010000000000"}
[W3C (47290369)] Driver proxy active, passing request on via HTTP proxy
[debug] [XCUITest] Executing command 'proxyReqRes'
[debug] [WD Proxy] Matched '/wd/hub/session/47290369-1558-4bae-98f7-ab0a3d0dc031/element/6E000000-0000-0000-7205-010000000000/click' to command name 'click'
[debug] [WD Proxy] Proxying [POST /wd/hub/session/47290369-1558-4bae-98f7-ab0a3d0dc031/element/6E000000-0000-0000-7205-010000000000/click] to [POST http://127.0.0.1:8100/session/7C394CAB-D8A7-4977-A463-97BE23B2671B/element/6E000000-0000-0000-7205-010000000000/click] with body: {"id":"6E000000-0000-0000-7205-010000000000"}
[debug] [WD Proxy] Got response with status 200: {"value":null,"sessionId":"7C394CAB-D8A7-4977-A463-97BE23B2671B"}
[WD Proxy] Replacing sessionId 7C394CAB-D8A7-4977-A463-97BE23B2671B with 47290369-1558-4bae-98f7-ab0a3d0dc031
[HTTP] <-- POST /wd/hub/session/47290369-1558-4bae-98f7-ab0a3d0dc031/element/6E000000-0000-0000-7205-010000000000/click 200 175 ms - 65
I can imagine the case, when after the first click you have more than one element, located by
**/XCUIElementTypeStaticText[`label == \"9\"`]
(e.g. because of something new with label 9 appeared..)
And the next click goes to the first found element, but it's not a button.
Try always to click the last found element from the list.
P. S. there are no issues with your appium logs.

Jenkins Appium job getting terminated while finding xpath

I am facing below issue on jenkins, job getting terminated once appium driver start finding xpath.
Same code is working fine in local script execution in my system.
Appium Logs:
[debug] [W3C (fb32b0a7)] Calling AppiumDriver.getWindowRect() with args: ["fb32b0a7-cca3-48cd-97e1-4e42fb0b9ea8"]
[debug] [WD Proxy] Matched '/window/current/size' to command name 'getWindowSize'
[debug] [WD Proxy] Proxying [GET /window/current/size] to [GET http://127.0.0.1:8200/wd/hub/session/c07ca9f1-c603-4ce8-a589-6d44b8935f58/window/current/size] with body: {}
[debug] [WD Proxy] Got response with status 200: {"sessionId":"c07ca9f1-c603-4ce8-a589-6d44b8935f58","value":{"height":2560,"width":1440}}
[debug] [W3C (fb32b0a7)] Responding to client with driver.getWindowRect() result: {"width":1440,"height":2560,"x":0,"y":0}
[HTTP] <-- GET /wd/hub/session/fb32b0a7-cca3-48cd-97e1-4e42fb0b9ea8/window/rect 200 41 ms - 50
[HTTP]
[HTTP] --> POST /wd/hub/session/fb32b0a7-cca3-48cd-97e1-4e42fb0b9ea8/touch/perform
[HTTP] {"actions":[{"action":"press","options":{"x":1008,"y":1792}},{"action":"wait","options":{"ms":2000}},{"action":"moveTo","options":{"x":1,"y":1792}},{"action":"release","options":{}}]}
[debug] [W3C (fb32b0a7)] Calling AppiumDriver.performTouch() with args: [[{"action":"press","options":{"x":1008,"y":1792}},{"action":"wait","options":{"ms":2000}},{"action":"moveTo","options":{"x":1,"y":1792}},{"action":"release","options":{}}],"fb32b0a7-cca3-48cd-97e1-4e42fb0b9ea8"]
[debug] [WD Proxy] Matched '/touch/perform' to command name 'performTouch'
[debug] [WD Proxy] Proxying [POST /touch/perform] to [POST http://127.0.0.1:8200/wd/hub/session/c07ca9f1-c603-4ce8-a589-6d44b8935f58/touch/perform] with body: {"startX":1008,"startY":1792,"endX":1,"endY":1792,"steps":56}
[debug] [WD Proxy] Got response with status 200: {"sessionId":"c07ca9f1-c603-4ce8-a589-6d44b8935f58","value":null}
[debug] [W3C (fb32b0a7)] Responding to client with driver.performTouch() result: null
[HTTP] <-- POST /wd/hub/session/fb32b0a7-cca3-48cd-97e1-4e42fb0b9ea8/touch/perform 200 2940 ms - 14
[HTTP]
[HTTP] --> GET /wd/hub/status
[HTTP] {}
[debug] [GENERIC] Calling AppiumDriver.getStatus() with args: []
[debug] [GENERIC] Responding to client with driver.getStatus() result: {"build":{"version":"1.16.0"}}
[HTTP] <-- GET /wd/hub/status 200 1 ms - 68
[HTTP]
[HTTP] --> POST /wd/hub/session/fb32b0a7-cca3-48cd-97e1-4e42fb0b9ea8/element
[HTTP] {"using":"xpath","value":"//*[contains(#text,'Not Now')]"}
[debug] [W3C (fb32b0a7)] Calling AppiumDriver.findElement() with args: ["xpath","//*[contains(#text,'Not Now')]","fb32b0a7-cca3-48cd-97e1-4e42fb0b9ea8"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [WD Proxy] Matched '/element' to command name 'findElement'
[debug] [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:8200/wd/hub/session/c07ca9f1-c603-4ce8-a589-6d44b8935f58/element] with body: {"strategy":"xpath","selector":"//*[contains(#text,'Not Now')]","context":"","multiple":false}
[debug] [WD Proxy] Got response with status 200: {"sessionId":"c07ca9f1-c603-4ce8-a589-6d44b8935f58","value":{"ELEMENT":"d9a20579-ec83-44c3-b25b-303103eea1e0","element-6066-11e4-a52e-4f735466cecf":"d9a20579-ec83-44c3-b25b-303103eea1e0"}}
[debug] [W3C (fb32b0a7)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"d9a20579-ec83-44c3-b25b-303103eea1e0","ELEMENT":"d9a20579-ec83-44c3-b25b-303103eea1e0"}
[HTTP] <-- POST /wd/hub/session/fb32b0a7-cca3-48cd-97e1-4e42fb0b9ea8/element 200 233 ms - 137
[HTTP]
[HTTP] --> DELETE /wd/hub/session/fb32b0a7-cca3-48cd-97e1-4e42fb0b9ea8
[HTTP] {}
[debug] [W3C (fb32b0a7)] Calling AppiumDriver.deleteSession() with args: ["fb32b0a7-cca3-48cd-97e1-4e42fb0b9ea8"]
[debug] [BaseDriver] Event 'quitSessionRequested' logged at 1583220093867 (12:51:33 GMT+0530 (India Standard Time))
[Appium] Removing session fb32b0a7-cca3-48cd-97e1-4e42fb0b9ea8 from our master session list
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [UiAutomator2] Deleting UiAutomator2 server session
[debug] [WD Proxy] Matched '/' to command name 'deleteSession'
[debug] [WD Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8200/wd/hub/session/c07ca9f1-c603-4ce8-a589-6d44b8935f58] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"c07ca9f1-c603-4ce8-a589-6d44b8935f58","value":null}

WebView treated like native in Appium Inspector and cannot switch to webview to find elements

I am testing a hybrid iOS mobile application. The first 2 screens are native, and then after that, there is a registration flow that is a WebView, and after registration the app goes back to native.
My question is that for the WebView screens, the Appium Inspector displays it to me as if it is a native screen. It gives me xpath identifiers for it that look like native elements (but are really slow to identify in actual testing).
Further, I don’t seem to be able to interact with those screens in Appium as if they are web elements. When I try to identify them using the id of the web element, Appium says css selector is not a valid locator strategy. I have tried adding a line of code that switches to a webview if it finds one, but frankly, I don’t see any sign in the appium logs that it actually tries this (though it also does not show an error about it).
I don’t understand what is happening here and would like to.
I am using Appium 1.13.0 and 1.14.0, running an iOS app on the simulator (12.2). I am using a codebase forked from https://github.com/webdriverio/appium-boilerplate.
An element looks like this in Appium Inspector:
<XCUIElementTypeTextField type="XCUIElementTypeTextField" value="Username" label="" enabled="true" visible="true" x="40" y="224" width="294" height="60"/>
and the locator that the Inspector provides me looks like this:
//XCUIElementTypeOther[#name="Login from mobile"]/XCUIElementTypeOther[4]/XCUIElementTypeTextField
But in a browser, the element looks like this:
<input id="username" name="username" placeholder="Username" type="text">
My capabilities look like this:
config.capabilities = [
{
// The defaults you need to have in your config
// browserName: 'safari',
platformName: 'iOS',
maxInstances: 1,
// For W3C the appium capabilities need to have an extension prefix
// This is `appium:` for all Appium Capabilities which can be found here
// http://appium.io/docs/en/writing-running-appium/caps/
'appium:deviceName': 'iPhone X',
'appium:platformVersion': '12.2',
'appium:orientation': 'PORTRAIT',
// `automationName` will be manatory, see
// https://github.com/appium/appium/releases/tag/v1.13.0
'appium:app': join(process.cwd(), './apps/AiView.app.zip'),
'appium:automationName': 'XCUITest',
'appium:newCommandTimeout': 240,
'autoAcceptAlerts': true,
'appium:noReset': false
},
];
A snippet of my actual test looks like this:
ParticipantLanguageScreen.setLanguageButton.click();
// That line is native code
driver.switchContext(this.getCurrentContexts()[1]);
ActivateLoginScreen.usernameInput.setValue(SC_USERNAME);
// That line should be a webview, but Appium is treating it as a native view
This locator works:
SC_USERNAME_INPUT: '//XCUIElementTypeOther[#name="Login from mobile"]/XCUIElementTypeOther[4]/XCUIElementTypeTextField'
But this one does not:
SC_USERNAME_INPUT: '#username'
Here is a part of the appium logs:
[HTTP] --> POST /wd/hub/session/30491fcf-e3c4-41bf-bad0-bbf1cc71d2f9/element
[HTTP] {"using":"accessibility id","value":"SET PARTICIPANT LANGUAGE"}
[W3C (30491fcf)] Calling AppiumDriver.findElement() with args: ["accessibility id","SET PARTICIPANT LANGUAGE","30491fcf-e3c4-41bf-bad0-bbf1cc71d2f9"]
[XCUITest] Executing command 'findElement'
[BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[BaseDriver] Waiting up to 0 ms for condition
[WD Proxy] Matched '/element' to command name 'findElement'
[WD Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/1E3BE1C7-5210-49E5-B405-FEE9393DEEB8/element] with body: {"using":"accessibility id","value":"SET PARTICIPANT LANGUAGE"}
[WD Proxy] Got response with status 200: {"value":{"ELEMENT":"C2030000-0000-0000-CE45-000000000000"},"sessionId":"1E3BE1C7-5210-49E5-B405-FEE9393DEEB8","status":0}
[W3C (30491fcf)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"C2030000-0000-0000-CE45-000000000000","ELEMENT":"C2030000-0000-0000-CE45-000000000000"}
[HTTP] <-- POST /wd/hub/session/30491fcf-e3c4-41bf-bad0-bbf1cc71d2f9/element 200 104 ms - 137
[HTTP]
[HTTP] --> POST /wd/hub/session/30491fcf-e3c4-41bf-bad0-bbf1cc71d2f9/element/C2030000-0000-0000-CE45-000000000000/click
[HTTP] {}
[W3C (30491fcf)] Driver proxy active, passing request on via HTTP proxy
[XCUITest] Executing command 'proxyReqRes'
[WD Proxy] Matched '/wd/hub/session/30491fcf-e3c4-41bf-bad0-bbf1cc71d2f9/element/C2030000-0000-0000-CE45-000000000000/click' to command name 'click'
[WD Proxy] Proxying [POST /wd/hub/session/30491fcf-e3c4-41bf-bad0-bbf1cc71d2f9/element/C2030000-0000-0000-CE45-000000000000/click] to [POST http://localhost:8100/session/1E3BE1C7-5210-49E5-B405-FEE9393DEEB8/element/C2030000-0000-0000-CE45-000000000000/click] with body: {}
[WD Proxy] Got response with status 200: {"status":0,"id":"C2030000-0000-0000-CE45-000000000000","value":"","sessionId":"1E3BE1C7-5210-49E5-B405-FEE9393DEEB8"}
[WD Proxy] Replacing sessionId 1E3BE1C7-5210-49E5-B405-FEE9393DEEB8 with 30491fcf-e3c4-41bf-bad0-bbf1cc71d2f9
[HTTP] <-- POST /wd/hub/session/30491fcf-e3c4-41bf-bad0-bbf1cc71d2f9/element/C2030000-0000-0000-CE45-000000000000/click 200 391 ms - 118
[HTTP] --> POST /wd/hub/session/30491fcf-e3c4-41bf-bad0-bbf1cc71d2f9/element
[HTTP] {"using":"css selector","value":"#username"}
[W3C (30491fcf)] Calling AppiumDriver.findElement() with args: ["css selector","#username","30491fcf-e3c4-41bf-bad0-bbf1cc71d2f9"]
[XCUITest] Executing command 'findElement'
[BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[W3C (30491fcf)] Encountered internal error running command: InvalidSelectorError: Locator Strategy 'css selector' is not supported for this session
[W3C (30491fcf)] at XCUITestDriver.validateLocatorStrategy (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:366:13)
[W3C (30491fcf)] at XCUITestDriver.validateLocatorStrategy (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:991:11)
[W3C (30491fcf)] at XCUITestDriver.validateLocatorStrategy [as findElOrElsWithProcessing] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/find.js:31:8)
[W3C (30491fcf)] at XCUITestDriver.findElOrElsWithProcessing [as findElement] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/find.js:53:21)
[W3C (30491fcf)] at curCommandCancellable._bluebird.default.resolve.then (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:305:66)
[W3C (30491fcf)] at tryCatcher (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/util.js:16:23)
[W3C (30491fcf)] at Promise._settlePromiseFromHandler (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/promise.js:517:31)
[W3C (30491fcf)] at Promise._settlePromise (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/promise.js:574:18)
[W3C (30491fcf)] at Promise._settlePromiseCtx (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/promise.js:611:10)
[W3C (30491fcf)] at _drainQueueStep (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/async.js:142:12)
[W3C (30491fcf)] at _drainQueue (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/async.js:131:9)
[W3C (30491fcf)] at Async._drainQueues (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/async.js:147:5)
[W3C (30491fcf)] at Immediate.Async.drainQueues (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/async.js:17:14)
[W3C (30491fcf)] at runCallback (timers.js:696:18)
[W3C (30491fcf)] at tryOnImmediate (timers.js:667:5)
[W3C (30491fcf)] at processImmediate (timers.js:649:5)
[HTTP] <-- POST /wd/hub/session/30491fcf-e3c4-41bf-bad0-bbf1cc71d2f9/element 400 96 ms - 2501
I expect the Appium Inspector to not give me element locators that are xpath and appear like native elements and I expect that my test can run with identifying web elements using id attributes.

Appium: Waiting for elements on iOS doesn't work anymore

I'm automizing tests for Android and iOS. Lately (probably after I've updated to appium 1.9.1 and java-client 6.1.0) I have issues with the iOS tests.
Many tests fail, because WebElements couldn't be found. I'm using WebDriverWait to find elements like in this example:
private WebElement getWebElement(By by, int timeOutInSeconds) {
return (new WebDriverWait(appiumDriver, timeOutInSeconds)).until(ExpectedConditions.presenceOfElementLocated(by));
}
The tests don't wait to find the element anymore. Instead an exception is thrown immediately.
I'm using XCUITest for iOS and uiautomator2 on android. On android the tests are still fine.
Edit (2018-10-29 18:33):
It feels like page factory is reporting the element is there, then randomElement.isDisplayed() will be executed on the element which throws directly an error, because it can't find the element.
And another observation:
In some cases the waiting duration works properly on iOS, but I couldn't find a pattern yet.
Edit (2018-12-14 15:56):
Still no solution found. Note: My tests make screenshots on failure. I can see on a lot of screenshots, the elements that caused the failure. The logs say they couldn't be found, but I can clearly see them on the screen. Makes no sense. Hoping for ideas!
Edit (2019-01-11 15:05):
In the logs, it looks like the element is found (response 200), but when I want to perform a click, it says it's 'not visible on the screen an thus not interactable'.
...
[HTTP] --> POST /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element
[HTTP] {"using":"id","value":"myapp"}
[debug] [W3C] Calling AppiumDriver.findElement() with args: ["id","buttonNext","59e9ace4-55a5-4b07-ad0e-af874dc42a6d"]
[debug] [XCUITest] Executing command 'findElement'
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/CE691ADA-FC54-48AE-9AA0-1DA6212DB2CC/element] with body: {"using":"id","value":"buttonNext"}
[debug] [JSONWP Proxy] Got response with status 200: {"value":{"ELEMENT":"24010000-0000-0000-0308-000000000000"},"sessionId":"CE691ADA-FC54-48AE-9AA0-1DA6212DB2CC","status":0}
[debug] [W3C] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"24010000-0000-0000-0308-000000000000"}
[HTTP] <-- POST /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element 200 180 ms - 88
[HTTP]
[HTTP] --> POST /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element/24010000-0000-0000-0308-000000000000/click
[HTTP] {"id":"24010000-0000-0000-0308-000000000000"}
[W3C] Driver proxy active, passing request on via HTTP proxy
[debug] [XCUITest] Executing command 'proxyReqRes'
[debug] [JSONWP Proxy] Matched '/wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element/24010000-0000-0000-0308-000000000000/click' to command name 'click'
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element/24010000-0000-0000-0308-000000000000/click] to [POST http://localhost:8100/session/CE691ADA-FC54-48AE-9AA0-1DA6212DB2CC/element/24010000-0000-0000-0308-000000000000/click] with body: {"id":"24010000-0000-0000-0308-000000000000"}
[debug] [JSONWP Proxy] Got response with status 200: {"value":"Error Domain=com.facebook.WebDriverAgent Code=1 \"The element '\"buttonNext\" Button' is not visible on the screen and thus is not interactable\" UserInfo={NSLocalizedDescription=The element '\"buttonNext\" Button' is not visible on the screen and thus is not interactable}","sessionId":"CE691ADA-FC54-48AE-9AA0-1DA6212DB2CC","status":13}
[debug] [W3C] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: The request to /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element/24010000-0000-0000-0308-000000000000/click has failed
[debug] [W3C] at JWProxy.proxy$ (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:182:13)
[debug] [W3C] at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[debug] [W3C] at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[debug] [W3C] at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[debug] [W3C] at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[debug] [MJSONWP] Matched JSONWP error code 13 to UnknownError
[HTTP] <-- POST /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element/24010000-0000-0000-0308-000000000000/click 500 4875 ms - 1779
[HTTP]
[HTTP] --> GET /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/screenshot
[HTTP] {}
...

Resources