facebookarchive / WebDriverAgent

A WebDriver server for iOS that runs inside the Simulator.
Other
4.15k stars 1.35k forks source link

WebDriver Agent takes too long to locate elements #1022

Open Jaspreet23 opened 5 years ago

Jaspreet23 commented 5 years ago

Hello, I am facing the same issue with my script/Appium taking too long to find the elements. Platform: iOS

For a simple step in my Gherkin Scenario : Click a trolley icon in Checkout This step has to look if any unavailable items are present then handle it

This alone step takes more than 1m and few seconds as it keeps looking for the element again and again in a loop. Attaching the logs for your reference. Please help as this issue is really making all the scripts very slow and time consuming. As an idea, the appium looks for an element which is not present for approx 20 times before it moves further which is making it extremely slow.

For finding elements, I am either relying on accessibility ids wherever I have access to those other wise I am using this approach @iOSXCUITFindBy(iOSNsPredicate = "name BEGINSWITH 'DRIVER INSTRUCTIONS'")

AppiumLogs.txt

Appium version : Version 1.7.0 (1.7.0) Last Appium version that did not exhibit the issue (if applicable):Never tried MAC OS/version used to run Appium:10.13.4 Node.js version (unless using Appium.app|exe):v10.10.0 Mobile platform/version under test: iOS Real device or emulator/simulator:Real device(iPhone 8) Appium CLI or Appium.app|exe: Kindly let me know if you need any other info.

Regards Jas

SamuelZhaoY commented 5 years ago

I have similar issues here: when I run WebDriverAgent separately with command line curl for getting a source, seems internally there are lots of exceptions:

018-10-31 10:40:21.354275+0800 WebDriverAgentRunner-Runner[38560:8142074] [general] Exception caught during decoding of received reply to message '_XCT_fetchAttributes:forElement:reply:', dropping incoming message and calling failure block.

Exception: Exception while decoding argument 0 (#1 of invocation):
<NSInvocation: 0x600001f1b4c0>
return value: {v} void
target: {@?} 0x0 (block)
argument 1: {@} 0x0
argument 2: {@} 0x0

Exception: value for key 'NS.objects' was of unexpected class 'XCAccessibilityElement'. Allowed classes are '{(
    NSArray,
    NSNumber,
    NSData,
    NSDictionary,
    NSDate,
    NSNull,
    NSSet,
    NSOrderedSet,
    NSString
)}'.
2018-10-31 10:40:41.579770+0800 WebDriverAgentRunner-Runner[38560:8132565] Enqueue Failure: Hit testing PageIndicator, {{0.0, 752.0}, {414.0, 42.0}}, identifier: 'Page control', value: Page 3 of 3 at point {207, 773} returned (null) which is from the same process but cannot be mapped using AX data: Failed to lookup parent of element Other, {{203.5, 767.0}, {7.0, 7.0}}: Timeout waiting for fulfillment of promise for 'Fetching attributes 'XC_kAXXCAttributeParent' for AX element pid: 35694, elementOrHash.elementID: 140447758744736.115'. /Users/Gangdooz/private/iOS/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1

My commands are:

export JSON_HEADER='-H "Content-Type:application/json"'
export DEVICE_URL='http://localhost:8100'

curl -X GET $JSON_HEADER \  
$DEVICE_URL/source
deena-p commented 5 years ago

I too facing this issue, it is taking so much time to collect the page source using appium. I am using Appium 1.9.1 and xcode 10.1

joshua-strickland commented 5 years ago

I am running into this as well on native pages with many UI elements. Pages with few ui elements appear to work fine, but pages with many elements may take 10 minutes or longer to perform a find elements call. Appium never seems to be able to actually target the element after this period either, saying element either is not found or is not clickable.

Appium 1.12.1 x code 10.2

I was able to collect the source by using the useJSONSource capability, but I am still unable to interact with any elements on this page with a lot of UI elements.