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

Appium 1.6.3 find_element by xpath locator strategy not working(at least on android) #7551

Closed
hardik-d opened this issue Dec 15, 2016 · 2 comments

Comments

@hardik-d
Copy link

hardik-d commented Dec 15, 2016

I am getting error:

"Selenium::WebDriver::Error::TimeOutError:
timed out after 10 seconds (An element could not be located on the page using the given search parameters.)"

Environment

  • Appium version (or git revision) that exhibits the issue: 1.6.3
  • Last Appium version that did not exhibit the issue (if applicable): N/A
  • Desktop OS/version used to run Appium: Mac OS X EL Capitan 10.11.6
  • Node.js version (unless using Appium.app|exe): v5
  • Mobile platform/version under test: Android 6.0
  • Real device or emulator/simulator: Emulator
  • Appium CLI or Appium.app|exe: N/A

piece of code that is failing:

set_context "NATIVE_APP"
within_context('NATIVE_APP') do
  wait_true(10) { @driver.find_element(:xpath, "//text[@value='7-Eleven']").displayed? }
  @driver.find_element(:xpath, "//text[@value='7-Eleven']").click
end

capabilities:

opts = {caps: {
platformName: 'Android',
udid: ENV["UDID"],
deviceName: "Android Emulator",
appPackage: 'com.paynearme.consumer.dev',
appActivity: 'com.paynearme.android.pnmc.MobileConsumer',
appWaitActivity: 'com.paynearme.android.pnmc.MobileConsumer',
dontStopAppOnReset: 'true',
app: '~/android-pnminc-dev-debug.apk'
}, appium_lib: { port: ENV["PORT"].present? ? ENV["PORT"] : "4723" }
}

appium inspector screen shot:

screen shot 2016-12-15 at 3 17 15 pm

appium logs:

https://gist.github.com/hardik-d/93f1a0e1feed00ed15ae5f5dffb1c36f

@triager triager added the Needs Triage bugs which are not yet confirmed label Dec 15, 2016
@jlipps
Copy link
Member

jlipps commented Dec 15, 2016

text is not a valid android classname. it's an attribute. You should print the source and make sure the xpath query you're constructing matches that. what you probably want is something more like:

//android.widget.TextView[@text='7-Eleven']

@jlipps jlipps closed this as completed Dec 15, 2016
@imurchie imurchie removed the Needs Triage bugs which are not yet confirmed label Apr 13, 2017
@lock
Copy link

lock bot commented Apr 28, 2019

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 Apr 28, 2019
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