“An element could not be located on the page using the given search parameters.”


I have Appium Test script recorded by Appium
Here is my script

package com.hostname.myapp;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;

public class AppiumTest {

private static AppiumDriver<AndroidElement> wd;

public static void setUpClass() throws MalformedURLException {

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("appium-version", "1.0");
    capabilities.setCapability("platformName", "Android");
    capabilities.setCapability("platformVersion", "5.0.2");
    capabilities.setCapability("deviceName", "XXXXXXXXXXXX");
    capabilities.setCapability("app", "/Users/X/X.apk");
    capabilities.setCapability("appPackage", "com.hostname.myapp");
    wd = new AndroidDriver<AndroidElement>(new URL(""), capabilities);
    wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

public static void tearDownClass() {
    if (wd != null) {

public void test() throws IOException {

After I package into MAVEN project and uploaded to AWS Device Farm.
The script run failed, and the error message is:

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: 10.27 seconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: ‘2.50.1’,
revision: ‘d7fc91b29de65b790abb01f3ac5f7ea2191c88a7’,
time: ‘2016-01-29 11:11:26’
System info: host: ‘ip-172-31-13-65’,
ip: ‘’,
os.name: ‘Linux’,
os.arch: ‘amd64’,
os.version: ‘3.13.0-53-generic’,
java.version: ‘1.8.0_65’
Driver info: io.appium.java_client.android.AndroidDriver Capabilities [{networkConnectionEnabled=true, desired={}, platformVersion=6.0.1, warnings={}, webStorageEnabled=false, locationContextEnabled=false, browserName=Android, takesScreenshot=true, javascriptEnabled=true, databaseEnabled=false, deviceName=6e4c6027, platform=LINUX}] Session ID: c0ec736d-c4d8-4b3a-8d3c-1beb24dd0782 ***
Element info: {Using=xpath, value=//android.widget.LinearLayout[1]/…/android.widget.EditText[1]}

If I am not wrong, my parameters of my elements are something wrong
But these path/parameter are recorded by Appium Insector
They should be correct, aren’t them?

I did Google search and I found an answer which told me to change xpath into

By.xpath("//android.widget.EditText[@text=‘Email ID’]")

But what should I do when I having 2 Textbox? I have username and password textbox

Thank a lot.


This means your search parameter is not correct, use By.xpath("//android.widget.EditText[@text=‘Email ID’]"), you have two edittext, but only password edittext fits the xpath, about another one, change the text value, or use other properties.


Hi Lee, thanks again for answering my questions
But I still didn’t get it
My search parameter is recorded by Appium Inspector,
it’s work when I clicked “Replay” in Appium Inspector. Why it won’t be correct?

I have 2 textbox:
//android.widget.LinearLayout/.../android.widget.EditText[1] is username textbox
//android.widget.LinearLayout/.../android.widget.EditText[2] is password textbox
How should I write into your form style?

Thanks you


I think you copied them directly from inspector. Not correct without inspector context.
try //android.widget.EditText[1] and //android.widget.EditText[2]
btw, many ways to find the elements, plz refer to the xpath grammar.


Yes, I copied from Inspector.
Do you mean I am doing wrong if I copied them?
What is the correct way to do so?

I did try //android.widget.EditText[1] and //android.widget.EditText[2]
My code is about:


And the error message is

Not yet implemented. Please help us: http://appium.io/get-involved.html (WARNING: The server did not provide any stacktrace information)


Can you show me some example to edit to make the script from Inspector workable? Thanks you


I don’t record the test script via appium, write python script directly.
about java, refer to appium examples:


Thank Lee, now I almost understand.
I will try to do so.
If we can’t use the script recorded by Appium Inspector, is it useless?
What is its main function?


Use ----> WebDriver driver; instead of AppiumDrivrer or AndroidDriver.

Use -----> RemoteWebDriver instead of AndroidDriver ie… new RemoteWebDriver(new URL(“url here”));

then use…

findElement(by.xpath(“xpath of element”);

then there will be no error…



Hi @kalvinlow i’m facing same issue.If your issue is resolved means can you help me


I have tried your suggestion… It did not make any difference. Still getting same error…