appium / appium/java-client

What replaced text/name in Appium if you are using Ruby and cucumber?

Open
#1,222 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

Description:

  • I have seen some answers to this question by the code is usually Java or Python

  • I am trying to locate an element but the only identifier I have available is the text

Environment:

  • Apium 1.14.0
  • uiautomatorviewer is being used to get the element description
  • testing on Android

The Ruby code:

And("I press on My conversions button") do
find_element(name:"My conversions")
end

Terminal error:

Locator Strategy 'name' is not supported for this session (Selenium::WebDriver::Error::InvalidSelectorError)
InvalidSelectorError: Locator Strategy 'name' is not supported for this session

I have followed suggestion to try searching using xpath but that did not work either:

Ruby:

And("I press on My conversions button") do
find_element(xpath:"//[@text='My conversions']")
end

Terminal error:

And I press on My conversions button # features/step_definitions/steps.rb:14
io.appium.uiautomator2.common.exceptions.InvalidSelectorException: java.lang.IllegalArgumentException: Unable to compile '//[@text='My conversions']'.

And tried Ruby:

And("I press on My conversions button") do
find_element(xpath:"//text[@value='My conversions']")
end

with terminal error: An element could not be located on the page using the given search parameters. (Selenium::WebDriver::Error::NoSuchElementError)

Also tried Ruby:

And("I press on My conversions button") do
find_element(xpath:"//*[@text='My conversions']")
end

  • this is not a web application so I would be surprised if x path worked

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The only project entry point mentioned is features/step_definitions/steps.rb:14, alongside the Android attributes shown by uiautomatorviewer. Start by checking which locator strategies Appium 1.14.0 supports for this Android session and comparing them with the element attributes. Done means the step uses a supported locator and can locate the element reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, ruby
Domain
mobile, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.