Has anyone faced an issue with Facebook login flow where there is context switching from the app to Facebook WEBVIEW and sendkeys() does not type the text into the username/password fields. Also, the tap is not functional.
here’s my code:
FB_EMAIL_XPATH = “//[contains(@value, ‘Email or Phone’)]”
FB_PASSWORD_XPATH = “//[contains(@value, ‘Password’)]”
FB_LOGIN_BUTTON_XPATH = “//*[contains(@name, ‘Log In’)]”
self.switch_to_webview_context()
print self.driver.find_element_by_xpath(self.FB_EMAIL_XPATH).text # this prints “Email or phone”
self.driver.find_element_by_xpath(self.FB_EMAIL_XPATH).click() # test gets stuck at this step
self.driver.find_element_by_xpath(self.FB_EMAIL_XPATH).send_keys(email)
self.type_text(By.XPATH, self.FB_PASSWORD_XPATH, password)
self.tap(By.XPATH, self.FB_LOGIN_BUTTON_XPATH)