Vyacheslav
Vyacheslav

Reputation: 662

Appium+Robot Framework: resource-ID element locator doesn't work as variable. It works as xpath variable

I am using Robot Framework 4.1.1 and Appium-Python-Client 1.2.0 to run a test on an Android native app. I tried to use the Resource-ID locator (=welcome.pages.welcome.title) in different ways:

  1. ${Welcome_element] = welcome.pages.welcome.title
  2. ${Welcome_element] = id=welcome.pages.welcome.title
  3. ${Welcome_element] = id="welcome.pages.welcome.title"
  4. ${Welcome_element] = //android.widget.TextView[@id=welcome.pages.welcome.title"]
  5. ${Welcome_element] = //android.widget.TextView[@resource-id=welcome.pages.welcome.title"]

I get results:

  1. Element locator 'welcome.pages.welcome.title' did not match any elements after 30 seconds
  2. Element locator 'id=welcome.pages.welcome.title' did not match any elements after 30 seconds
  3. Element locator 'id="welcome.pages.welcome.title"' did not match any elements after 30 seconds
  4. Element locator '//android.widget.TextView[@id=welcome.pages.welcome.title"]' did not match any elements after 30 seconds
  5. The keyword works as expected

So, I found the workaround. But how I can use just the ID value in the variable? The first case doesn't work and I don't understand why.

Upvotes: 1

Views: 1059

Answers (1)

Luciano Gonçalves
Luciano Gonçalves

Reputation: 277

try use the equal symbol near the variable

${Welcome_element]=  welcome.pages.welcome.title

and at least two space after...

Upvotes: 0

Related Questions