Automating browser actions from an external script is easier than you think.
The answer: Selenium.
Selenium is a browser automation tool suite which is compatible with several popular browsers, such as Firefox, Chrome, Internet Explorer and Opera. It is primarily written in Java, but it also has extensions for Python and Ruby.
from selenium import webdriver from selenium.webdriver.common.keys import Keys browser = webdriver.Firefox() browser.get('http://google.com') assert 'Google' in browser.title searchBoxes = browser.find_elements_by_id('gbqfq') searchBoxes.send_keys('hello' + Keys.RETURN)