You could program your robot to click in a place that the firefox icon is (or launch a new firefox program), then firefox would have the focus and you can send keypresses to firefox.