I am automating a flow that consists in tapping in the Product Name from a Product List which is a Xamarin ListView to go into de Product Details Page.
I have set in my ListView:
AutomationProperties.IsInAccessibleTree="false"
And in the Product Name Label:
AutomationId="ProductName"
The funny thing is that when using Appium Desktop UI inspection tool I can see the XPATH and if I record tapping into it, it actually works and I get this script:
MobileElement el1 = (MobileElement) driver.findElementByXPath("(//XCUIElementTypeStaticText[@name=\"ProductName\"])[1]");
el1.click();
For that I know that the XPATH exists and is visible to Appium. It works in the inspection tool.
Now, when I translate this to Python, something goes wrong:
el1 = self.driver.find_element_by_xpath("(//XCUIElementTypeStaticText[@name=\"ProductName\"])[1]")
I get this error message:
el = self.driver.find_element_by_xpath(element_query) File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 393, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 966, in find_element 'value': value})['value'] File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 320, in execute self.error_handler.check_response(response) File "/Users/joseclua/Library/Python/3.7/lib/python/site-packages/appium/webdriver/errorhandler.py", line 29, in check_response raise wde File "/Users/joseclua/Library/Python/3.7/lib/python/site-packages/appium/webdriver/errorhandler.py", line 24, in check_response super(MobileErrorHandler, self).check_response(response) File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters.