Appium cannot locate an element

I am trying to identify the below element with name=“Open record Bazyzwlso Kbrie”. Appium Inspector recommends to use accessibility id ‘Open record Bazyzwlso Kbrie’. But when I run the Appium code (Java) none of the below strategies are working, not even xpath. Every time it throws ‘NoSuchElementException’ . Kindly help. I dont have a clue why it is not working. Only recent change made by the developers was upgrading the react navigation library from v4 to v5.

driver.findElementByName(“Open record Bazyzwlso Kbrie”).click();
driver.findElementByAccessibilityId(“Open record Bazyzwlso Kbrie”).click();
driver.findElementById(“Open record Bazyzwlso Kbrie”).click();
driver.findElement(MobileBy.id(“Open record Bazyzwlso Kbrie”)).click();
driver.findElement(By.xpath("//*[@name=‘Open record Bazyzwlso Kbrie’]")).click();

----please see part of the page source below ------
XCUIElementTypeScrollView type=“XCUIElementTypeScrollView” enabled=“true” visible=“true” x=“0” y=“189” width=“414” height=“707”
XCUIElementTypeOther type=“XCUIElementTypeOther” name=“TODAY” label=“TODAY” enabled=“true” visible=“true” x=“0” y=“220” width=“414” height=“43”/
XCUIElementTypeOther type=“XCUIElementTypeOther” name=“Open record Bazyzwlso Kbrie” label=“Open record Bazyzwlso Kbrie” enabled=“true” visible=“true” x=“0” y=“262” width=“414” height=“87”/
XCUIElementTypeOther type=“XCUIElementTypeOther” enabled=“true” visible=“true” x=“0” y=“348” width=“414” height=“15”/
/XCUIElementTypeScrollView

maybe you misprinted?

Code: different name
Source: [quote=“mssarika, post:1, topic:32842”]
name=“Open record Bazyzwlso Kbrie”
[/quote]
Just as Aleksei said :wink:
I would recommend using variables for the labels/names, simpler to adjust in the automation, later.

Thank you for your replies.
Sorry but that was a copy paste error here and as the value changes every time I am of course using a variable there. It was just for clarity purpose that I used the value of the variable here in the post. I will update the post.
I am stuck with the issue, though the page source has the element in it, the driver.findElement with any location strategy cannot find it. When I do a search for the keyword in page source it retrieves true. So it means though Appium inspector can find the element the findElement cannot. Any idea why that can be ?

I think i have the same issue, I get timeouts when trying to tap on a text button down the page ( swipe needed ).
I’ll try to provide logs soon.

[Xcode] 2021-01-20 13:55:02.453029+0200 WebDriverAgentRunner-Runner[1023:291664] Quiescence checks are disabled for [[[[MY-IOS-APPLICATION]]]] application. Making it to believe it is idling
[Xcode]
[Xcode] 2021-01-20 13:55:02.453418+0200 WebDriverAgentRunner-Runner[1023:291664] Quiescence checks are disabled for [[[[MY-IOS-APPLICATION]]]] application. Making it to believe there are no animations
[Xcode]
[debug] [WD Proxy] Got response with status 200: {“value”:null,“sessionId”:“D48E6219-EB29-4AFA-AF5D-E4D0CACB1DA2”}
[WD Proxy] Replacing sessionId D48E6219-EB29-4AFA-AF5D-E4D0CACB1DA2 with 3223aa19-df23-45cc-90af-663fe7673641
[HTTP] <-- POST /wd/hub/session/3223aa19-df23-45cc-90af-663fe7673641/element/860B0000-0000-0000-0204-000000000000/click 200 24570 ms - 65
[HTTP]
[HTTP] --> POST /wd/hub/session/3223aa19-df23-45cc-90af-663fe7673641/elements
[HTTP] {“using”:“accessibility id”,“value”:“tf_clientno”}
[debug] [W3C (3223aa19)] Calling AppiumDriver.findElements() with args: [“accessibility id”,“tf_clientno”,“3223aa19-df23-45cc-90af-663fe7673641”]
[debug] [XCUITest] Executing command ‘findElements’
[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] [XCUITest] Setting custom timeout to 180000 ms for ‘findElements’ command
[debug] [WD Proxy] Matched ‘/elements’ to command name ‘findElements’
[debug] [WD Proxy] Proxying [POST /elements] to [POST http://127.0.0.1:8118/session/D48E6219-EB29-4AFA-AF5D-E4D0CACB1DA2/elements] with body: {“using”:“accessibility id”,“value”:“tf_clientno”}
[Xcode] 2021-01-20 13:55:14.493358+0200 WebDriverAgentRunner-Runner[1023:291664] Getting the most recent active application (out of 1 total items)
[Xcode]
[Xcode] t = 269.24s Get all elements bound by accessibility element for: Elements matching predicate ‘wdName == “tf_clientno” AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 OR placeholderValue == 0 OR selected == 0)’
[Xcode]
[Xcode] t = 269.24s Requesting snapshot of accessibility hierarchy for app with pid 1026
[Xcode]
[Xcode] t = 269.41s Find: Descendants matching type Any
[Xcode]
[Xcode] t = 269.41s Find: Elements matching predicate ‘wdName == “tf_clientno” AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 OR placeholderValue == 0 OR selected == 0)’
[Xcode]
[Xcode] t = 269.42s Requesting snapshot of accessibility hierarchy for app with pid 1026
[Xcode]
[Xcode] t = 269.55s Find: Descendants matching type Any
[Xcode]
[Xcode] t = 269.55s Find: Elements matching predicate ‘wdName == “tf_clientno” AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 OR placeholderValue == 0 OR selected == 0)’
[Xcode]
[Xcode] t = 269.56s Find: Identity Binding
[Xcode]
[debug] [WD Proxy] Got response with status 200: {“value”:[{“element-6066-11e4-a52e-4f735466cecf”:“C80A0000-0000-0000-0204-000000000000”,“label”:“tfl_clientno”,“type”:“XCUIElementTypeTextField”,“ELEMENT”:“C80A0000-0000-0000-0204-000000000000”}],“sessionId”:“D48E6219-EB29-4AFA-AF5D-E4D0CACB1DA2”}
[debug] [W3C (3223aa19)] Responding to client with driver.findElements() result: [{“ELEMENT”:“C80A0000-0000-0000-0204-000000000000”,“element-6066-11e4-a52e-4f735466cecf”:“C80A0000-0000-0000-0204-000000000000”,“label”:“tfl_clientno”,“type”:“XCUIElementTypeTextField”}]
[HTTP] <-- POST /wd/hub/session/3223aa19-df23-45cc-90af-663fe7673641/elements 200 348 ms - 196
[HTTP]
[HTTP] --> POST /wd/hub/session/3223aa19-df23-45cc-90af-663fe7673641/element
[HTTP] {“using”:"-ios predicate string",“value”:“label == “tfl_clientno””}
[debug] [W3C (3223aa19)] Calling AppiumDriver.findElement() with args: ["-ios predicate string",“label == “tfl_clientno””,“3223aa19-df23-45cc-90af-663fe7673641”]
[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] [XCUITest] Setting custom timeout to 241000 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:8118/session/D48E6219-EB29-4AFA-AF5D-E4D0CACB1DA2/element] with body: {“using”:“predicate string”,“value”:“label == “tfl_clientno””}
[Xcode] 2021-01-20 13:55:15.847765+0200 WebDriverAgentRunner-Runner[1023:291664] Getting the most recent active application (out of 1 total items)
[Xcode]
[Xcode] t = 270.59s Get all elements bound by accessibility element for: Elements matching predicate ‘wdLabel == “tfl_clientno” AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 OR placeholderValue == 0 OR selected == 0)’
[Xcode]
[Xcode] t = 270.60s Requesting snapshot of accessibility hierarchy for app with pid 1026
[Xcode]
[Xcode] t = 270.76s Find: Descendants matching type Any
[Xcode]
[Xcode] t = 270.76s Find: Elements matching predicate ‘wdLabel == “tfl_clientno” AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 OR placeholderValue == 0 OR selected == 0)’
[Xcode]
[Xcode] t = 270.77s Checking existence of "tf_clientno" TextField
[Xcode]
[Xcode] t = 270.77s Requesting snapshot of accessibility hierarchy for app with pid 1026
[Xcode]
[Xcode] t = 270.90s Find: Descendants matching type Any
[Xcode]
[Xcode] t = 270.90s Find: Elements matching predicate ‘wdLabel == “tfl_clientno” AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 OR placeholderValue == 0 OR selected == 0)’
[Xcode]
[Xcode] t = 270.91s Find: Identity Binding
[Xcode]
[debug] [WD Proxy] Got response with status 200: {“value”:{“element-6066-11e4-a52e-4f735466cecf”:“C80A0000-0000-0000-0204-000000000000”,“label”:“tfl_clientno”,“type”:“XCUIElementTypeTextField”,“ELEMENT”:“C80A0000-0000-0000-0204-000000000000”},“sessionId”:“D48E6219-EB29-4AFA-AF5D-E4D0CACB1DA2”}
[debug] [W3C (3223aa19)] Responding to client with driver.findElement() result: {“ELEMENT”:“C80A0000-0000-0000-0204-000000000000”,“element-6066-11e4-a52e-4f735466cecf”:“C80A0000-0000-0000-0204-000000000000”,“label”:“tfl_clientno”,“type”:“XCUIElementTypeTextField”}
[HTTP] <-- POST /wd/hub/session/3223aa19-df23-45cc-90af-663fe7673641/element 200 346 ms - 194
[HTTP]
[HTTP] --> POST /wd/hub/session/3223aa19-df23-45cc-90af-663fe7673641/element/C80A0000-0000-0000-0204-000000000000/value
[HTTP] {“value”:[“T”,“X”,"-",“Q”,“A”,"-",“1”,“0”,“0”,“0”,“2”,“0”,“2”,“1”,“0”,“1”,“2”,“0”,“1”,“3”,“5”,“5”,“1”,“5”],“text”:“TX-QA-100020210120135515”}
[debug] [W3C (3223aa19)] Calling AppiumDriver.setValue() with args: [[“T”,“X”,"-",“Q”,“A”,"-",“1”,“0”,“0”,“0”,“2”,“0”,“2”,“1”,“0”,“1”,“2”,“0”,“1”,“3”,“5”,“5”,“1”,“5”],“C80A0000-0000-0000-0204-000000000000”,“3223aa19-df23-45cc-90af-663fe7673641”]
[debug] [XCUITest] Executing command ‘setValue’
[debug] [XCUITest] Setting custom timeout to 240000 ms for ‘setValue’ command
[debug] [WD Proxy] Matched ‘/element/C80A0000-0000-0000-0204-000000000000/value’ to command name ‘setValue’
[debug] [Protocol Converter] Added ‘text’ property “TX-QA-100020210120135515” to ‘setValue’ request body
[debug] [WD Proxy] Proxying [POST /element/C80A0000-0000-0000-0204-000000000000/value] to [POST http://127.0.0.1:8118/session/D48E6219-EB29-4AFA-AF5D-E4D0CACB1DA2/element/C80A0000-0000-0000-0204-000000000000/value] with body: {“value”:[“T”,“X”,"-",“Q”,“A”,"-",“1”,“0”,“0”,“0”,“2”,“0”,“2”,“1”,“0”,“1”,“2”,“0”,“1”,“3”,“5”,“5”,“1”,“5”],“text”:“TX-QA-100020210120135515”}
[Xcode] t = 270.93s Requesting snapshot of accessibility hierarchy for app with pid 1026
[Xcode]
[Xcode] t = 271.05s Find: Descendants matching type Any
[Xcode]
[Xcode] t = 271.05s Find: Elements matching predicate ‘wdLabel == “tfl_clientno” AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 OR placeholderValue == 0 OR selected == 0)’
[Xcode]
[Xcode] t = 271.06s Find: Identity Binding
[Xcode]
[Xcode] 2021-01-20 13:55:16.322623+0200 WebDriverAgentRunner-Runner[1023:291664] Neither the “XCUIElementTypeTextField (tf_clientno)” element itself nor its accessible descendants have the keyboard input focus
[Xcode] 2021-01-20 13:55:16.322725+0200 WebDriverAgentRunner-Runner[1023:291664] Trying to tap the “XCUIElementTypeTextField (tf_clientno)” element to have it focused
[Xcode]
[Xcode] t = 271.06s Tap “tf_clientno” TextField
[Xcode] t = 271.06s Wait for [[[[MY-IOS-APPLICATION]]]] to idle
[Xcode]
[Xcode] 2021-01-20 13:55:22.328345+0200 WebDriverAgentRunner-Runner[1023:291664] Quiescence checks are disabled for [[[[MY-IOS-APPLICATION]]]] application. Making it to believe it is idling
[Xcode]
[Xcode] 2021-01-20 13:55:22.328726+0200 WebDriverAgentRunner-Runner[1023:291664] Quiescence checks are disabled for [[[[MY-IOS-APPLICATION]]]] application. Making it to believe there are no animations
[Xcode]
[Xcode] t = 283.08s Find the “tf_clientno” TextField
[Xcode]
[Xcode] t = 283.08s Requesting snapshot of accessibility hierarchy for app with pid 1026
[Xcode]
[Xcode] t = 283.25s Find: Descendants matching type Any
[Xcode]
[Xcode] t = 283.26s Find: Elements matching predicate ‘wdLabel == “tfl_clientno” AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 OR placeholderValue == 0 OR selected == 0)’
[Xcode]
[Xcode] t = 283.26s Find: Identity Binding
[Xcode]
[Xcode] t = 283.27s Check for interrupting elements affecting “tf_clientno” TextField
[Xcode]
[Xcode] t = 283.27s Requesting snapshot of accessibility hierarchy for app with pid 1026
[Xcode]
[Xcode] t = 283.37s Find: Descendants matching predicate identifier == “NotificationShortLookView” OR elementType == 7
[Xcode]
[Xcode] t = 283.37s Synthesize event
[Xcode]
[Xcode] t = 283.38s Scroll element to visible
[Xcode]
[Xcode] t = 283.40s Find the “tf_clientno” TextField
[Xcode]
[Xcode] t = 283.40s Requesting snapshot of accessibility hierarchy for app with pid 1026
[Xcode]
[Xcode] t = 283.62s Find: Descendants matching type Any
[Xcode]
[Xcode] t = 283.62s Find: Elements matching predicate ‘wdLabel == “tfl_clientno” AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 OR placeholderValue == 0 OR selected == 0)’
[Xcode]
[Xcode] t = 283.62s Find: Identity Binding
[Xcode]
[Xcode] t = 284.63s Find the “tf_clientno” TextField (retry 1)
[Xcode]
[Xcode] t = 284.64s Requesting snapshot of accessibility hierarchy for app with pid 1026
[Xcode]
[Xcode] t = 285.00s Find: Descendants matching type Any
[Xcode]
[Xcode] t = 285.01s Find: Elements matching predicate ‘wdLabel == “tfl_clientno” AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 OR placeholderValue == 0 OR selected == 0)’
[Xcode]
[Xcode] t = 285.01s Find: Identity Binding
[Xcode]
[Xcode] t = 286.01s Find the “tf_clientno” TextField (retry 2)
[Xcode]
[Xcode] t = 286.02s Requesting snapshot of accessibility hierarchy for app with pid 1026
[Xcode]
[Xcode] t = 308.71s Find: Descendants matching type Any
[Xcode]
[Xcode] t = 308.71s Find: Elements matching predicate ‘wdLabel == “tfl_clientno” AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 OR placeholderValue == 0 OR selected == 0)’
[Xcode]
[Xcode] t = 308.72s Find: Identity Binding
[Xcode]
[Xcode] t = 308.73s Collecting extra data to assist test failure triage
[Xcode]
[Xcode] t = 308.73s Requesting snapshot of accessibility hierarchy for app with pid 1026
[Xcode]
[WD Proxy] Error: timeout of 360000ms exceeded
[WD Proxy] at createError (/usr/local/Cellar/appium/1.20.1/libexec/lib/node_modules/appium/node_modules/axios/lib/core/createError.js:16:15)
[WD Proxy] at RedirectableRequest.handleRequestTimeout (/usr/local/Cellar/appium/1.20.1/libexec/lib/node_modules/appium/node_modules/axios/lib/adapters/http.js:280:16)
[WD Proxy] at Object.onceWrapper (node:events:486:26)
[WD Proxy] at RedirectableRequest.emit (node:events:379:20)
[WD Proxy] at ClientRequest.eventHandlers. (/usr/local/Cellar/appium/1.20.1/libexec/lib/node_modules/appium/node_modules/follow-redirects/index.js:13:24)
[WD Proxy] at ClientRequest.emit (node:events:379:20)
[WD Proxy] at Socket.emitRequestTimeout (node:_http_client:812:9)
[WD Proxy] at Object.onceWrapper (node:events:485:28)
[WD Proxy] at Socket.emit (node:events:391:22)
[WD Proxy] at Socket._onTimeout (node:net:482:8)
[WD Proxy] at listOnTimeout (node:internal/timers:556:17)
[WD Proxy] at processTimers (node:internal/timers:499:7)
[debug] [W3C (3223aa19)] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: timeout of 360000ms exceeded
[debug] [W3C (3223aa19)] at JWProxy.command (/usr/local/Cellar/appium/1.20.1/libexec/lib/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:275:13)
[debug] [W3C (3223aa19)] at runMicrotasks ()
[debug] [W3C (3223aa19)] at processTicksAndRejections (node:internal/process/task_queues:94:5)
[HTTP] <-- POST /wd/hub/session/3223aa19-df23-45cc-90af-663fe7673641/element/C80A0000-0000-0000-0204-000000000000/value 500 60015 ms - 692
[HTTP]
[HTTP] --> DELETE /wd/hub/session/3223aa19-df23-45cc-90af-663fe7673641

Tried with all attributes that field contain
Specs: The field i want to add text to it’s not visible at first, and i see the appium slides down to it. ( visually it makes it visible )

The problem is the iphone app it’s getting frozen, and i think there’s where the appium goes into timeout.
Any clues on where to look over?

try -> http://appium.io/docs/en/writing-running-appium/tutorial/swipe-tutorial/

Hello,
tried with swipe, the element is on 2nd page, one swipe’s enough, but still, even after i swipe to proper screen, the result is the same: element is not hittable ( even if i see it visible )

I used driver.execute_script(‘mobile: swipe’, direction: … ) and it works. but the visible element it’s not properly working :frowning: