Saurabh Shrivastava Saurabh Shrivastava - 3 months ago 34
Python Question

Send keys without specifying element in python selenium webdriver

I have a page whose source code is not available, but there is a input box where cursor is blinking.

Can i write something into the text box without finding the element. I mean, some way where send key can automatically look for focussed inputbox and type input to it.

My code does not work obviuosly

driver.send_keys("testdata")

Answer

solved it

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