Send keys without specifying element in python selenium webdriver Send keys without specifying element in python selenium webdriver selenium selenium

Send keys without specifying element in python selenium webdriver


solved it

from selenium.webdriver.common.action_chains import ActionChainsactions = ActionChains(self.driver)actions.send_keys('dummydata')actions.perform()


If you get error about 'self' in this code:

from selenium.webdriver.common.action_chains import ActionChainsactions = ActionChains(self.driver)actions.send_keys('dummydata')actions.perform()

just use:

actions = ActionChains(driver)

I don't have comment rights that's why I put this as answer

Edit: Added this enhancement as a comment on the original answer.


This worked for me:

driver.find_element_by_tag_name('body').send_keys(' ')

(Which I used to use a space character to scroll through a page)