Is this supported? Xcode 6, Appium 1.3.4, iOS 7.1 and iOS 8.1 and ruby 2.2.0

$appiumDriver.find_element(:xpath,‘textfield[@value=“New Passcode”]’)

When I run the above command I get the following error:
An element could not be located on the page using the given search parameters. (Selenium::WebDriver::Error::NoSuchElementError)

I can find the element by providing the direct xpath. Want to check if the above command works or I am doing something wrong?


$appiumDriver.textfield('New Passcode')

If you want to use xpath, it needs to be valid. textfield is not a valid widget on Android, usually it’d be an EditText. On iOS it’s UIATextField or UIASecureTextField.

1 Like

Thank you for your help.
I got what i was looking for.

how about this in ios?
@driver.find_element(:xpath, ‘//UIAButton[@name=“CREATE A NEW ACCOUNT”]’).click

get Selenium::WebDriver::Error::NoSuchElementError: An element could not be located on the page using the given search parameters.

def get_element_by_xpath(element_path)
raise ElementNotFoundException, element_path

def get_email_with_subject(subject)
if @iosTest
email_subject = $appiumDriver.wait(45){get_element_by_xpath("//UIATableView[1]/UIATableCell[contains(@name,’#{subject}’)]")}

Sometimes when trying to find an element by xpath and performing a click on it, you will need to store it in a variable and then click. Like in the get_email_with_subject method above.

Feel free to let me know if you need more help.


Hi Diana,

I am not sure if storing in an element should matter but i also see a sleep in your code and suspect that could really matter. Will try out both and let you know but every time sleep fixes an issue a part of me dies inside. I would really like to know what’s happening then slowing my test down for it to work. again thanks though. will let you know.

  • Hardik

I know what you mean with sleep. Its sort of a race condition for now. It finds the element but when click happens it returns Element ID could not be tapped. A sleep sort of fixes it for the time being.

Regarding storing the value, for me it did matter. If the element was not returned both click and send_keys failed for me. iOS and android.