Is it possible to imitate keyboard input via Command Line or Python Code in digitalocean headless Ubuntu?
Is it possible to imitate Keyboard input via Command Line or Python Code?
If possible, do I have to additionally install some kind of Dependencies to make keyboard input?
I am worried that I can’t generate keyboard input because digitalocean linux doesn’t have real keyboard or input device attached to it.
I am currently using Selenium with python, and there are lines of code which imitates keyboard input to a Firefox browser. For example,
from selenium.webdriver.common.keys import Keys
driver.findelementbytagname(‘body’).send_keys(Keys.CONTROL + ’t’)
Unfortunately, this code doesn’t work, after trying a lot of tests.
I found that the code I used actually runs well on my local linux, which has real keyboard device.
I think I’m sure that being unable to give keyboard input is not Selenium nor other third-party software problem. I guess the problem resides in the fact that Ubuntu is headless and doesn’t have input device attached to it.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×