I am having an issue with using xpath in my scripts. When I use the Appium inspector to locate and element using this xpath “//android.widget.TextView[@text=‘My Messages’]” the inspector locates it with no problems. But when I try to use that xpath in my code like this
driver.findElement(By.xpath("//android.widget.TextView[@text='My Messages']")).click();
I get and error message that says
org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 20.16 seconds For documentation on this error, please visit: Selenium Build info: version: ‘2.42.2’, revision: ‘6a6995d31c7c56c340d6f45a76976d43506cd6cc’, time: ‘2014-06-03 10:52:47’ System info: host: ‘C02P98XHG3QD’, ip: ‘127.0.0.1’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.9.5’, java.version: ‘1.7.0_79’ Session ID: 0701451b-c82d-7899-6030-099e74bc9fd4 Driver info: io.appium.java_client.android.AndroidDriver
I am not quite sure what I am doing wrong. Am I doing something wrong, or could this be an issue with Appium. I am currently using version 1.4.8