IOS Spinner Xpath

I am currently working on Native APP. Here i have a spinner and i want script to wait till that is disappeared.
But in the source code i am not able to find XPATH for the spinner to use the below code.

FluentWait wait = new WebDriverWait(getDriver(), 150);//Integer.parseInt(Constants.getProperty(“pagefluentWait”))
wait.withTimeout(150, TimeUnit.SECONDS).pollingEvery(2, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);
wait.withMessage(“APP ERROR :: Waited 150 secs for load image to no longer be visible.”);
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(“XPATH”)));

Currently i am using “//UIAActivityIndicator[@name=‘In progress’]” as XPATH as UIAActivityIndicator gives the status of the DOM whether fully loaded. But this is not efficient.

Is there any work around to pause my script till the spinner is disappeared.

is the accessibility box ticked in the source code?

ticked means - is it visible in source code?

the element on the storyboard under the identity inspector there is a box that next to it says Accessibility

are you mentioning appium tool

nope in the xcode app

It is unchecked, do you want me to check it. and how does that help

check it, that lets the appium inspector see it.

Sorry, i didn’t get that. I get pagesource from driver.getpagesource(), and my script acts on that. How both are related.

maybe i misunderstood your question i thought you couldnt get the xpath to the spinner object

In AUT I’m trying to automate spinner is of type UIActivityIndicatorView.

How to wait for this in iOS with appium java client ?

Thanks,
Vikram

Ask developer to give accessibility identifier for spinner, they can give you. Insert in below snippet

FluentWait wait = new WebDriverWait(getDriver(), 150);//Integer.parseInt(Constants.getProperty(“pagefluentWait”))
wait.withTimeout(150, TimeUnit.SECONDS).pollingEvery(2, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);
wait.withMessage(“APP ERROR :: Waited 150 secs for load image to no longer be visible.”);
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(“YOUR XPATH”)));

1 Like

@Boney Please find update on this issue

  1. Per developer the element doesn’t have accessibility identifier.

  2. I stared AUT with arc and with command “source” found the type of spinner as XCUIElementTypeActivityIndicator

  3. Now I’m waiting for //XCUIElementTypeActivityIndicator to show first and later go away.

  4. But I feel much better approach is mentioned in
    Is it possible to wait until animation is finished before interacting with element?

  5. Without arc it is impossible to get the xpath of the spinner.

  6. It will be nice if client provides method similar to https://groups.google.com/forum/#!topic/calabash-ios/E4HLfLdIgjM

Thanks,
Vikram

@Boney My developer asked to put Accessibility identifier myself.

One related question is Accessibility identifier and Accessibility label values can be same ?

I opened my AUT project in xcode and saw these 2 values, will put the values myself to merge into main project.