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.find_element_by_tag_name(‘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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I’ve not personally worked with Selenium, though I did find a few posts that may hopefully help you out.
http://www.alittlemadness.com/2008/03/05/running-selenium-headless/
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.