Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading