Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find element by text #241

Closed
bootstraponline opened this issue Mar 7, 2013 · 5 comments
Closed

Find element by text #241

bootstraponline opened this issue Mar 7, 2013 · 5 comments

Comments

@bootstraponline
Copy link
Member

Is there a way to find elements by text or should I just use XPath?

$driver.find_element :text, 'Sign In'
ArgumentError: cannot find element by :text
@jlipps
Copy link
Member

jlipps commented Mar 7, 2013

Just use xpath. "text" is not a selenium selector strategy.

$driver.find_element :xpath, '//text[@value="Sign In"]'

or

$driver.find_element :xpath, '//text[@text="Sign In"]'

(value was added to android for compatibility with ios).

@jlipps jlipps closed this as completed Mar 7, 2013
sebv pushed a commit to sebv/appium that referenced this issue May 12, 2014
@hardik-d
Copy link

@jlipps this does not work in appium 1.6.3, is it a known issue #7551 Any workaround?

@jlipps
Copy link
Member

jlipps commented Dec 15, 2016

@hardik-d the android xml schema changed since 3.5 years ago, see my comment on #7551

@141801
Copy link

141801 commented Jan 9, 2019

$driver.find_element :xpath, '//text[@value="Sign In"]'

Not a native element method
I want to get element by text .I tried your advices but it just work well for webview element

2019-01-09 17 41 14

@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants