Taylor Radl
Taylor Radl

Reputation: 11

Is there a way to send keys to a selenium window without finding a element?

I would like to send keys to the whole driver window in the background. So I can have a game window open and the driver will have keys sent to it.

I need to send the keys to just that window.

Upvotes: 0

Views: 1659

Answers (1)

Prophet
Prophet

Reputation: 33361

You can send keys to the body element of the web page. It will actually be equally to sending the text to a whole driver window.
This can be done as following:

driver.find_element_by_xpath('//body').send_keys("The text you want to send")

Upvotes: 2

Related Questions