Floating issue - Sometimes appium could not find elements by xpath on web page on IOS device

Hi, i’m automating IOS webapp testing on custom browser and using xpath locators because it’s on POC stage. Sometimes Appium couldn’t find element but I see that it definitely present visually and in page source. What could cause this issue and what could bedone there?

appium 2.0.0
xcuitest driver 4.25.3
xcode version 14.3
macOS Venture 13.2.1

Below I’m trying find the following element
Proxying [POST /elements] to [POST http://127.0.0.1:8300/session/4C284E88-DFF9-4F8C-A31A-60FD93F98BB6/elements] with body: {“using”:“xpath”,“value”:"//XCUIElementTypeCell[@name=“DUO”]"}

but it returns

Got response with status 200: {“value”:[],“sessionId”:“4C284E88-DFF9-4F8C-A31A-60FD93F98BB6”}

In page source below this element is present

Page source <?xml version="1.0" encoding="UTF-8"?>
<XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="true" accessible="false" x="0" y="0" width="375" height="667" index="0">

  <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="375" height="667" index="0">

    <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="375" height="667" index="0">

      <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="375" height="667" index="0">

        <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="375" height="667" index="0">

          <XCUIElementTypeNavigationBar type="XCUIElementTypeNavigationBar" name="Bluetooth" enabled="true" visible="true" accessible="false" x="0" y="20" width="375" height="44" index="0">

            <XCUIElementTypeButton type="XCUIElementTypeButton" name="Settings" label="Settings" enabled="true" visible="true" accessible="true" x="0" y="20" width="94" height="44" index="0"/>

            <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="Bluetooth" name="Bluetooth" label="Bluetooth" enabled="true" visible="true" accessible="true" x="149" y="32" width="78" height="21" index="1"/>

          </XCUIElementTypeNavigationBar>

          <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="375" height="667" index="1">

            <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="375" height="667" index="0">

              <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="375" height="667" index="0">

                <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="375" height="667" index="0">

                  <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="375" height="667" index="0">

                    <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="375" height="667" index="0">

                      <XCUIElementTypeTable type="XCUIElementTypeTable" enabled="true" visible="true" accessible="false" x="0" y="0" width="375" height="667" index="0">

                        <XCUIElementTypeCell type="XCUIElementTypeCell" value="1" name="Bluetooth" label="Bluetooth" enabled="true" visible="true" accessible="true" x="16" y="99" width="343" height="44" index="0">

                          <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="Bluetooth" name="BLUETOOTH" label="Bluetooth" enabled="true" visible="true" accessible="true" x="32" y="111" width="74" height="21" index="0"/>

                          <XCUIElementTypeSwitch type="XCUIElementTypeSwitch" value="1" name="Bluetooth" label="Bluetooth" enabled="true" visible="true" accessible="true" x="292" y="105" width="51" height="32" index="1"/>

                        </XCUIElementTypeCell>

                        <XCUIElementTypeOther type="XCUIElementTypeOther" name="Now discoverable as “iPhone 7”." enabled="true" visible="true" accessible="false" x="0" y="143" width="375" height="30" index="1">

                          <XCUIElementTypeOther type="XCUIElementTypeOther" name="Now discoverable as “iPhone 7”." label="Now discoverable as “iPhone 7”." enabled="true" visible="true" accessible="true" x="0" y="143" width="375" height="30" index="0"/>

                        </XCUIElementTypeOther>

                        <XCUIElementTypeOther type="XCUIElementTypeOther" name="MY DEVICES" enabled="true" visible="true" accessible="false" x="0" y="173" width="375" height="38" index="2">

                          <XCUIElementTypeOther type="XCUIElementTypeOther" name="MY DEVICES" label="MY DEVICES" enabled="true" visible="true" accessible="true" x="0" y="173" width="375" height="38" index="0"/>

                        </XCUIElementTypeOther>

                        <XCUIElementTypeCell type="XCUIElementTypeCell" value="Not Connected" name="DUO" label="DUO" enabled="true" visible="true" accessible="true" x="16" y="211" width="343" height="44" index="3">

                          <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="DUO" name="6A8B0DF0-5BC6-C05B-0C55-B3EC986D62C6" label="DUO" enabled="true" visible="true" accessible="true" x="32" y="223" width="151" height="21" index="0"/>

                          <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="32" y="254" width="327" height="1" index="1"/>

                          <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="Not Connected" name="Not Connected" label="Not Connected" enabled="true" visible="true" accessible="true" x="195" y="223" width="116" height="21" index="2"/>

                          <XCUIElementTypeButton type="XCUIElementTypeButton" name="More Info" label="More Info" enabled="true" visible="true" accessible="true" x="318" y="220" width="26" height="26" index="3"/>

                        </XCUIElementTypeCell>

                        <XCUIElementTypeCell type="XCUIElementTypeCell" value="Not Connected" name="IQOS" label="IQOS" enabled="true" visible="true" accessible="true" x="16" y="255" width="343" height="44" index="4">

                          <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="IQOS" name="3AD59B7E-9E85-81D3-153D-52C61FECD2E0" label="IQOS" enabled="true" visible="true" accessible="true" x="32" y="267" width="151" height="21" index="0"/>

                          <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="32" y="298" width="327" height="1" index="1"/>

                          <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="Not Connected" name="Not Connected" label="Not Connected" enabled="true" visible="true" accessible="true" x="195" y="267" width="116" height="21" index="2"/>

                          <XCUIElementTypeButton type="XCUIElementTypeButton" name="More Info" label="More Info" enabled="true" visible="true" accessible="true" x="318" y="264" width="26" height="26" index="3"/>

                        </XCUIElementTypeCell>

                        <XCUIElementTypeCell type="XCUIElementTypeCell" value="Not Connected" name="IQOS" label="IQOS" enabled="true" visible="true" accessible="true" x="16" y="299" width="343" height="44" index="5">

                          <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="IQOS" name="CFFB3FDB-0697-ACA0-212F-2FE3A1761A59" label="IQOS" enabled="true" visible="true" accessible="true" x="32" y="311" width="151" height="21" index="0"/>

                          <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="32" y="342" width="327" height="1" index="1"/>

                          <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="Not Connected" name="Not Connected" label="Not Connected" enabled="true" visible="true" accessible="true" x="195" y="311" width="116" height="21" index="2"/>

                          <XCUIElementTypeButton type="XCUIElementTypeButton" name="More Info" label="More Info" enabled="true" visible="true" accessible="true" x="318" y="308" width="26" height="26" index="3"/>

                        </XCUIElementTypeCell>

                        <XCUIElementTypeCell type="XCUIElementTypeCell" value="Not Connected" name="IQOS" label="IQOS" enabled="true" visible="true" accessible="true" x="16" y="343" width="343" height="44" index="6">

                          <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="IQOS" name="80501389-6070-BAA8-3BC0-D58D3A933282" label="IQOS" enabled="true" visible="true" accessible="true" x="32" y="355" width="151" height="21" index="0"/>

                          <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="32" y="386" width="327" height="1" index="1"/>

                          <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="Not Connected" name="Not Connected" label="Not Connected" enabled="true" visible="true" accessible="true" x="195" y="355" width="116" height="21" index="2"/>

                          <XCUIElementTypeButton type="XCUIElementTypeButton" name="More Info" label="More Info" enabled="true" visible="true" accessible="true" x="318" y="352" width="26" height="26" index="3"/>

                        </XCUIElementTypeCell>

                        <XCUIElementTypeCell type="XCUIElementTypeCell" value="Not Connected" name="VEEV" label="VEEV" enabled="true" visible="true" accessible="false" x="16" y="387" width="343" height="44" index="7">

                          <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" accessible="false" x="16" y="430" width="343" height="1" index="0"/>

                          <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="VEEV" name="69372CA7-5F32-3217-14E3-E45862761BAB" label="VEEV" enabled="true" visible="true" accessible="true" x="32" y="399" width="151" height="21" index="1"/>

                          <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="Not Connected" name="Not Connected" label="Not Connected" enabled="true" visible="true" accessible="true" x="195" y="399" width="116" height="21" index="2"/>

                          <XCUIElementTypeButton type="XCUIElementTypeButton" name="More Info" label="More Info" enabled="true" visible="true" accessible="true" x="318" y="396" width="26" height="26" index="3"/>

                        </XCUIElementTypeCell>

                        <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="431" width="375" height="18" index="8"/>

                        <XCUIElementTypeOther type="XCUIElementTypeOther" name="OTHER DEVICES" enabled="true" visible="true" accessible="false" x="0" y="448" width="375" height="45" index="9">

                          <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="OTHER DEVICES" name="OTHER DEVICES" label="OTHER DEVICES" enabled="true" visible="true" accessible="true" x="32" y="470" width="102" height="17" index="0"/>

                          <XCUIElementTypeActivityIndicator type="XCUIElementTypeActivityIndicator" value="1" name="In progress" label="In progress" enabled="true" visible="true" accessible="true" x="143" y="468" width="21" height="21" index="1"/>

                        </XCUIElementTypeOther>

                        <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="492" width="375" height="49" index="10">

                          <XCUIElementTypeTextView type="XCUIElementTypeTextView" value="To pair an Apple Watch with your iPhone, go to the Apple Watch app." enabled="true" visible="true" accessible="false" x="32" y="492" width="311" height="49" index="0">

                            <XCUIElementTypeTextView type="XCUIElementTypeTextView" name="To pair an Apple Watch with your iPhone, go to the Apple Watch app." label="To pair an Apple Watch with your iPhone, go to the Apple Watch app." enabled="true" visible="true" accessible="true" x="32" y="500" width="311" height="33" index="0">

                              <XCUIElementTypeLink type="XCUIElementTypeLink" name="Apple Watch app" label="Apple Watch app" enabled="true" visible="true" accessible="false" x="32" y="516" width="104" height="17" index="0"/>

                            </XCUIElementTypeTextView>

                          </XCUIElementTypeTextView>

                        </XCUIElementTypeOther>

                        <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="OTHER DEVICES" name="OTHER DEVICES" label="OTHER DEVICES" enabled="true" visible="false" accessible="true" x="32" y="470" width="102" height="17" index="11"/>

                        <XCUIElementTypeActivityIndicator type="XCUIElementTypeActivityIndicator" value="1" name="In progress" label="In progress" enabled="true" visible="false" accessible="true" x="143" y="468" width="21" height="21" index="12"/>

                      </XCUIElementTypeTable>

                    </XCUIElementTypeOther>

                  </XCUIElementTypeOther>

                </XCUIElementTypeOther>

              </XCUIElementTypeOther>

            </XCUIElementTypeOther>

          </XCUIElementTypeOther>

        </XCUIElementTypeOther>

      </XCUIElementTypeOther>

    </XCUIElementTypeOther>

  </XCUIElementTypeOther>

</XCUIElementTypeWindow>

<XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="false" accessible="false" x="0" y="0" width="375" height="667" index="1">

  <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" accessible="false" x="0" y="0" width="375" height="667" index="0">

    <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" accessible="false" x="0" y="0" width="375" height="667" index="0"/>

  </XCUIElementTypeOther>

</XCUIElementTypeWindow>
Appium logs

2023-08-15 10:56:15:210 [XCUITestDriver@fa94 (5ad7c6a6)] Matched ‘/source?scope=AppiumAUT’ to command name ‘getPageSource’

2023-08-15 10:56:15:210 [XCUITestDriver@fa94 (5ad7c6a6)] Proxying [GET /source?scope=AppiumAUT] to [GET http://127.0.0.1:8300/session/4C284E88-DFF9-4F8C-A31A-60FD93F98BB6/source?scope=AppiumAUT] with no body

2023-08-15 10:56:17:601 [XCUITestDriver@fa94 (5ad7c6a6)] Got response with status 200: {“value”:"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n <XCUIElementTypeApplication type=“XCUIElementTypeApplication” name=“Settings” label=“Settings” enabled=“true” visible=“true” accessible=“false” x=“0” y=“0” width=“375” height=“667” index=“0”>\n <XCUIElementTypeWindow type=“XCUIElementTypeWindow” enabled=“true” visible=“true” accessible=“false” x=“0” y=“0” width=“375” height=“667” index=“0”>\n <XCUIElementTypeOther type=“XCUIElementTypeOther” enabled=“true” visible=“true” accessible=“false” x=“0” y=“0” width=“375” height=“667” index=“0”>\n <XCUIElementTypeOther type=“XCUIElementTypeOther” enabled=“true” visible=“true” accessible=“false” x=“0” y=“0” width=“375” height=“667” index=“0”>\n <XCUIElementTypeOther type=“XCUIElementTypeOther” enabled=“true” visible=“true” accessible=“false” x=“0” y=“0” width=“375” height=“667” index=“0”>\n <XCUIElementTypeOther type="XC…

2023-08-15 10:56:17:601 [XCUITestDriver@fa94 (5ad7c6a6)] Responding to client with driver.getPageSource() result: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n <XCUIElementTypeApplication type=“XCUIElementTypeApplication” name=“Settings” label=“Settings” enabled=“true” visible=“true” accessible=“false” x=“0” y=“0” width=“375” height=“667” index=“0”>\n <XCUIElementTypeWindow type=“XCUIElementTypeWindow” enabled=“true” visible=“true” accessible=“false” x=“0” y=“0” width=“375” height=“667” index=“0”>\n <XCUIElementTypeOther type=“XCUIElementTypeOther” enabled=“true” visible=“true” accessible=“false” x=“0” y=“0” width=“375” height=“667” index=“0”>\n <XCUIElementTypeOther type=“XCUIElementTypeOther” enabled=“true” visible=“true” accessible=“false” x=“0” y=“0” width=“375” height=“667” index=“0”>\n <XCUIElementTypeOther type=“XCUIElementTypeOther” enabled=“true” visible=“true” accessible=“false” x=“0” y=“0” width=“375” height=“667” index=“0”>\n <XCUIElementTypeOther type="XCUIElement…

2023-08-15 10:56:17:602 [HTTP] <-- GET /session/5ad7c6a6-f23f-4716-86fb-0d58776894bf/source 200 2393 ms - 15649

2023-08-15 10:56:17:602 [HTTP]

2023-08-15 10:56:17:603 [HTTP] --> POST /session/5ad7c6a6-f23f-4716-86fb-0d58776894bf/elements

2023-08-15 10:56:17:603 [HTTP] {“using”:“xpath”,“value”:"//XCUIElementTypeCell[@name=“DUO”]"}

2023-08-15 10:56:17:604 [XCUITestDriver@fa94 (5ad7c6a6)] Calling AppiumDriver.findElements() with args: [“xpath”,"//XCUIElementTypeCell[@name=“DUO”]",“5ad7c6a6-f23f-4716-86fb-0d58776894bf”]

2023-08-15 10:56:17:604 [XCUITestDriver@fa94 (5ad7c6a6)] Executing command ‘findElements’

2023-08-15 10:56:17:604 [XCUITestDriver@fa94 (5ad7c6a6)] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id, css selector

2023-08-15 10:56:17:604 [XCUITestDriver@fa94 (5ad7c6a6)] Waiting up to 0 ms for condition

2023-08-15 10:56:17:606 [XCUITestDriver@fa94 (5ad7c6a6)] Matched ‘/elements’ to command name ‘findElements’

2023-08-15 10:56:17:607 [XCUITestDriver@fa94 (5ad7c6a6)] Proxying [POST /elements] to [POST http://127.0.0.1:8300/session/4C284E88-DFF9-4F8C-A31A-60FD93F98BB6/elements] with body: {“using”:“xpath”,“value”:"//XCUIElementTypeCell[@name=“DUO”]"}

2023-08-15 10:56:18:549 [XCUITestDriver@fa94 (5ad7c6a6)] Got response with status 200: {“value”:[],“sessionId”:“4C284E88-DFF9-4F8C-A31A-60FD93F98BB6”}

2023-08-15 10:56:18:549 [XCUITestDriver@fa94 (5ad7c6a6)] Responding to client with driver.findElements() result: []

2023-08-15 10:56:18:550 [HTTP] <-- POST /session/5ad7c6a6-f23f-4716-86fb-0d58776894bf/elements 200 946 ms - 12