Search code examples
xcodeappiumrobotframeworkappium-ios

Unable to locate elements using XPath in Robot Framework


I am trying to Input Text into a XCUIElementTypeSecureTextField. So far I have tried the following methods:

Input Text    //XCUIElementTypeTextField[@name="Email"]    abcd@gmail.com

The element is visible but got the error message as

ValueError: Element locator '//XCUIElementTypeSecureTextField[@name=“Password”]' did not match any elements.

I am using iOS SDK version: 14.0 and Appium version: 1.19.1

My DOM:

<XCUIElementTypeTextField type="XCUIElementTypeTextField" value="Email" name="Email" label="" enabled="true" visible="true" x="35" y="395" width="344" height="41"/>

Solution

  • Input Text    xpath=//XCUIElementTypeTextField[@name="Email"]    abcd@gmail.com
    

    why don't you use the name=? (this would easily work as well)

    Input Text  name=Email  Test
    

    How do I use Click Element function with robot framework when the element does not have id or name?