Reputation: 345
I am writing some E2E tests with Appium 2, latest XCUITest and Python. I stumbled upon a problem. For some reason, even though I see the element and its Accessibility ID/XPATH (screenshot attached), I am unable to click it as I get the error below:
NoSuchElementError: An element could not be located on the page using the given search parameters.
at XCUITestDriver.doNativeFind
Here is my click code and driver configuration.
'ios': (AppiumBy.ACCESSIBILITY_ID, 'Book with Apple Pay'), # tried XPATH as well
def pay_with_apple_pay(self):
self.wait_for_element_to_be_displayed(self.privacy_policy_link[self.os])
self.wait_for_element_clickable(self.change_payment_method_button[self.os]).click()
self.wait_for_element_clickable(self.apple_pay_select[self.os]).click()
self.wait_for_element_clickable(self.book_with_apple_pay_button[self.os]).click()
options = XCUITestOptions()
options.platform_name = 'iOS'
options.platform_version = config['ios']['platform_version']
options.device_name = config['ios']['device_name']
options.automation_name = 'XCUITest'
options.auto_accept_alerts = True
options.no_reset = False
options.is_headless = config['ios']['is_headless']
options.set_capability('showXcodeLog', True)
options.set_capability('appium:maxTypingFrequency', 10)
options.set_capability('simpleIsVisibleCheck', True)
options.set_capability('appium:settings[snapshotMaxDepth]', 62)
options.set_capability('appium:settings[pageSourceExcludedAttributes]', ['visible'])
options.set_capability('appium:settings[customSnapshotTimeout]', 500)
options.set_capability('appium:includeSafariInWebviews', True)
options.set_capability('appium:isInspectable', True)
options.set_capability('appium:webviewConnectTimeout', 9000)
I can find any other element no problem. Not sure why I can't click Pay with Apple Pay, any info is appreciated.
Upvotes: 0
Views: 26