Firefox can be controlled by Python. To do this you need the selenium module and a web driver. The Python code starts the web browser and then completely controls it.
The code can then do anything you can do with a web browser, like opening a page, sending key presses or button clicks.
Take a look at the selenium firefox code. First import the webdriver, then make it start firefox.
Open a webage with the get page and optionally send keypresses.