2

Using Robot Framework with combination of Appium and Selenium2Library/SeleniumLibrary. If I tried to run my script with some xpath locators like as below

 AppiumLibrary.Click Element                       xpath=//android.widget.TextView[@text='Site Control'] 

in keywords file then getting below the error message.

Error Message:

Finding '//android.widget.EditText[@index='4']' using 'XPATH' with the contextId: '' multiple: true

Appium Logs:

 [debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command of type ACTION
 [debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command action: find
 [debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Finding '//android.widget.EditText[@index='4']' using 'XPATH' with the contextId: '' multiple: true

Robot Script:

 Click on Site Control and Create Case
      AppiumLibrary.Click Element                       xpath=//android.widget.TextView[@text='Site Control']
      sleep                                             ${timeout}
      AppiumLibrary.click element                       xpath=//android.widget.EditText[@index='4']
      sleep                                             ${timeout}
      AppiumLibrary.input text                          xpath=//android.widget.EditText[@text='Intallationid']   site212
Raman
  • 444
  • 6
  • 21

2 Answers2

0

it means that your locator is not that unique. Please try to add more unique attributes like //android.widget.EditText[@index='4' and @attribute='value']

Ben
  • 1
  • locator working only one time and on second time execution. Multiple:True error is displaying in Appium logs and automation get paused until manual stop – Raman Mar 16 '19 at 12:39
  • I have tried all abs and relative xpath combinations – Raman Mar 16 '19 at 12:41
0

Finally, found an answer for this error message. Issue is Development team are maintaining common variable names for UI elements in their React Native code to reuse it and to overcome from this error is adding the UiAutomator2 capabilities like below:

For Java with Appium (Appium Java Client)

capabilities.setCapability("automationName", "UiAutomator2");

For Robot Framework (robot AppiumLibrary)

automationName=UiAutomator2 (inside open application keyword)

Why this error was coming? Appium isn't supporting UiAutomator automation if our device/emulator OS version is >= 6. I was using 7+. So, I have switch to UiAutomator2 and Make sure JAVA_HOME & ANDROID_HOME is set properly.

Raman
  • 444
  • 6
  • 21