Unable to Click a Navigator Link while Automating the Test on iPhone

strong textIm Trying to test an app on iOS, and I’m trying to find elements by XPATH I’m supposed to enable a click to Create Account hyperlink, while I’m trying to find the element by path using name as attribute I’m getting an error , here’s the error file and script

Appium : 1.6.4
iOS Version : 10.3
Script: CreateAccount = self.driver.find_element_by_xpath(’//XCUIElementTypeApplication[@name=“Payload”]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeButton(a[@id=“Create Account”])’) #Actions element = CreateAccount element.click()

Error: Traceback (most recent call last): File “test_a2.py”, line 41, in test_a2 CreateAccount = self.driver.find_element_by_id(’//XCUIElementTypeApplication[@name=“Payload”]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeButton(a[@id=“Create Account”])’) File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py”, line 271, in find_element_by_id return self.find_element(by=By.ID, value=id_) File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py”, line 756, in find_element ‘value’: value})[‘value’] File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py”, line 238, in execute self.error_handler.check_response(response) File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/appium/webdriver/errorhandler.py”, line 29, in check_response raise wde NoSuchElementException: Message: An element could not be located on the page using the given search parameters.

That just means it can’t find the element. Are you positive the xpath is correct? This part looks a little odd…

XCUIElementTypeButton(a[@id="Create Account"])

Maybe you meant…

XCUIElementTypeButton[@id="Create Account"]

This is the path and it still unable to find the element
CreateAccount = self.driver.find_element_by_xpath(’//XCUIElementTypeApplication[@name=“C by GE 2.1”]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeButton[@name=“Create Account”]’)

Have you tried:
CreateAccount = self.driver.find_element_by_xpath("//XCUIElementTypeButton[@id=‘Create Account’]")

Could you check if this works. In iOS it used to be just ids.