noSuchElementException in Amazon Device Farm


I´ve run a sucessful test for an iPar Air 2 from chosen from the Amazon device farm. Then I run the same test after selecting iPhone 5s from Amazon device farm and it fails. The error message says “noSuchElementException”. The test is written in Java, and Both devices have iOS 10.2.
Does somebody know why is this happening?


Different versions of devices can have different UI’s, and sometimes the same selector will not work.

Unless there’s an underlying bug or misconfiguration, the answer is going to be tweaking your selector. Are you using XCUITest, and if so, are predicates your selector method?

You could post the selector here, but most likely you will just need to inspect the UI of your app, and craft a selector that will work on both platforms.

Also, make sure the app is open, and that other parts of the Appium connection are working fine.

Kind regards, and hope this helps.

Thank you for your answer, Emil.

I am using is XCUITest, and my selector method is:
WebElement alert = driver.findElement(By.className(“UIAAlert”));
So should I to assert that the class UIAAlert is not suitable for an iphone? Then How cani I reffer to an UIAAlert object on an iphone device?


Hi Paco7778,

If you are able to find more details about the object, I suspect you will have a better chance of success.

Here is an example of crafting a complex predicate:

Are you certain that the element appears on the current page? You can do something comparable to (this python example:

There will be some Java equivalent I’m sure, and this will allow you to confirm which page Appium thinks it’s one, and help you both make sure it contains the element you’re trying to select, and give you the details of what fields the element has.

Are you watching the screen? One thing I found in testing is that smaller errors can lead to issues like this by, say, an attempt to switch pages in the app failing.

Good luck.

why is this marked as news?

Can you please share the page source? As your device ios 10 above so the locator strategy no more use UI Automation.

You should try something like:

WebElement alert = driver.findElement(By.className(“XCUIElementTypeAlert”));

The issue goes on with “XCUIElementTypeAlert”. It works for ipad but not for iphone.

My page source is
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.ios.IOSDriver;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.util.List;


  • Created by appium on 13/3/17.
    public class appiumTest {

    //private RemoteWebDriver driver;

    // public AppiumDriver driver;

    private AppiumDriver driver;

    private List values;

    public WebDriverWait wait ;
    public void setup() throws MalformedURLException{
    DesiredCapabilities desiredCapabilities;

     desiredCapabilities = new DesiredCapabilities();
     desiredCapabilities.setCapability("deviceName","IPad Air2");
     //desiredCapabilities.setCapability("deviceName","iPhone 5s");
     desiredCapabilities.setCapability("xcodeSigningId","iPhone Developer");
     //requiredcapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.iOS);
     //requiredcapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Ipad Air2 Device");
     //driver = new IOSDriver(new URL(""),desiredCapabilities);
      driver = new IOSDriver<WebElement>(new URL(""),desiredCapabilities);
     //driver = new RemoteWebDriver(new URL(""),desiredCapabilities){};
     wait=new WebDriverWait(driver,60);


    public void tearDown() throws Exception{

    public void selectLoginWithEmail() {

     List<WebElement> elems = driver.findElements(By.className("UIATextField"));
     for (WebElement elem : elems) {
     //WebElement cajaCorreo = driver.findElement("Email"));
     WebElement cajaCorreo = driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]"));
     WebElement button = driver.findElement(By.className("UIAButton"));;
     //WebElement texto =driver.findElement(By.className("UIAAlert"));
     WebElement texto = driver.findElement(By.className("XCUIElementTypeAlert"));
     String texto2 = texto.getAttribute("label");
     Assert.assertTrue("Correcto",texto2.equalsIgnoreCase("Login KO"));
     //try {
     //    Thread.sleep(55000);
     //} catch (InterruptedException e) {


An the error message Amazon returns is:

selectLoginWithEmail failed: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 910 milliseconds For documentation on this error, please visit: Build info: version: ‘2.48.2’, revision: ‘41bccdd10cf2c0560f637404c2d96164b67d9d67’, time: ‘2015-10-09 13:08:06’ System info: host: ‘ip-172-31-13-65’, ip: ‘’, ‘Linux’, os.arch: ‘amd64’, os.version: ‘3.13.0-53-generic’, java.version: ‘1.8.0_65’ Driver info: io.appium.java_client.ios.IOSDriver Capabilities [{app=com.ibermatica.PruebaAppium, networkConnectionEnabled=false, appiumVersion=v1.6.0, xcodeOrgId=DXKN9UUK5Q, databaseEnabled=false, deviceName=IPad Air2, xcodeSigningId=iPhone Developer, platform=MAC, realDeviceLogger=/usr/local/lib/node_modules/deviceconsole/deviceconsole, platformVersion=10.2.1, webStorageEnabled=false, locationContextEnabled=false, browserName=, takesScreenshot=true, javascriptEnabled=true, platformName=iOS, udid=278d7a1371d7a4fc9e2eb0b4639c70969e0eaaa3}] Session ID: 55054aef-5092-4d0a-a77b-8c0eb3ae2205 *** Element info: {Using=class name, value=XCUIElementTypeAlert}

Any help would be appreciated.

1 Like

On a failure like this I will often do a driver.getPageSource. You could do this before the call that fails and then see what is in the screen. I’m suspecting that this might be a good use case for an implicit wait, but not entirely sure.

The issue has been fixed by rewitting the app code in such a way that all the text boxes, and the login button appear into the device´screen, for ipad as much as iphone.
Thank you very much for your suggestions.