I am doing hybrid app iOS automation using Appium. Not able to find the element using findElementsByAccessibilityId and findElementByName. Only findElementByXpath is working fine.
Can you tell me why i am not able to use other two properties
driver.findElementsByAccessibilityId(“Contact Us”) - not working
driver.findElementByName(“Contact Us”) - not working
driver.findElementByXpath(" //UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAWebView[1]/UIAStaticText[46]") - working fine
You should grab the page_source right before you’re attempting to perform those actions to see what physically exists in the page_source. Perhaps there’s simply no AccessiblityID or Name specified for the element?
Contact Us is available in both name and label attributes. I am able to access this element like below.
driver.findElement(By.xpath("//UIAStaticText[@name=‘Contact Us’]"));
Thanks for your support. But my question is why i am not able to access this using below command.
driver.findElement(By.name(“Contact Us”);
I know that by_name was supposed to be deprecated at some point. Perhaps it has. Check the Appium log for specific reasons for your failure with that feature.