XCUITest element, taking too much time for find, click and send text on on xcitest element

HI

I am trying to click, send and verify xcuitest element but its taking too much time(like more then 3 min) although page is already render completely

its look like my xpath is taking too much time(more than 4 to 5 min for taking any action after complete page render ) for click, send or find element on page… ID is not available on page only value, name, label and text is available on mobile page… plz suggest how to resolve this issue, although i tried online solution (on google) but unable to find any solution

I am using below xpath:-

SUBMIT BUTTON

//XCUIElementTypeButton[@ type=‘XCUIElementTypeButton’ and @name=‘SUBMIT’ and @label=‘SUBMIT’]

SEARCH TEXT BOX

//XCUIElementTypeTextField[@ type=‘XCUIElementTypeTextField’ and @value=‘nter or paste up to 30 VINs’]

HOME BUTTON

//XCUIElementTypeButton[@ type=‘XCUIElementTypeButton’ and @name = ‘HOME’ and @label =‘HOME’]

--------:I am providing few line of page source here:—

      </XCUIElementTypeOther>

      <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="-231" y="126" width="230" height="40">

        <XCUIElementTypeButton type="XCUIElementTypeButton" name="VW GOOGLE SEARCH" label="VW GOOGLE SEARCH" enabled="true" visible="false" x="-231" y="126" width="229" height="40"/>

        <XCUIElementTypeImage type="XCUIElementTypeImage" name="sub-link-inactive" enabled="true" visible="false" x="-230" y="126" width="40" height="40"/>

      </XCUIElementTypeOther>

      <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="-231" y="171" width="230" height="40">

        <XCUIElementTypeButton type="XCUIElementTypeButton" name="LOGOUT" label="LOGOUT" enabled="true" visible="false" x="-231" y="171" width="229" height="40"/>

--------------------->>>>>>>>>>>>>>>>>> Other sencond query:-

how to use “driver.findElement(MobileBy.iOSNsPredicateString” and “driver.findElement(MobileBy.iOSClassChain” with example,

Generally automation speed in iOS is slow as compared to Android, if page has large number of elements it become more slow. Instead of xpath try to use accesibilityID or predicate string:-

driver.findElementByAccessibilityId(“SUBMIT”);

driver.findElement(MobileBy.iOSNsPredicateString(“type == ‘XCUIElementTypeButton’ AND name == ‘SUBMIT’”));

This may improve execution speed.

1 Like

https://appium.readthedocs.io/en/latest/en/commands/element/find-elements/

XPath Search the app XML source using xpath (not recommended, has performance issues)

Hi Isha,

Thank you so much for your help and reply… today i used iOSNsPredicateString as locator and its fast as compare to xpath… but its still taking 1 min for performing task… accesibilityID is not present on page… could you plz guid me how to improve execution speed.