I have a python script that uses Selenium and, in the script, a Google Login (OAuth) button is clicked and a new window is displayed as shown below:
In the new window, thanks to the superb UX :P, the input element for the email field is already selected. Since the field is already selected, can I use Selenium to just start typing without finding the input element and using send_key
?
CodePudding user response:
from selenium.webdriver.common.action_chains import ActionChains
actions = ActionChains(driver)
actions.send_keys('hotmail.com')
actions.perform()
Try using action chains to send the keys over.
CodePudding user response:
Just switch to active element .switch_to.active_element
:
element = driver.switch_to.active_element
element.send_keys('value')