-1

I would love to write in Python a program that can:

  1. Launch firefox browser
  2. Pass automatically a given URL to that browser

I have no idea if Python does even allow this. You can just give me a hint like the name of the library that does this work (if it exists) and I will do the rest myself.

  • 1
    Soo.. write it? If you'd love to do it i mean :) Programming is not so much "if it can" as it is "what you can", Python can do it and I know FireFox is quite modular. `subprocess.Popen` ;) – Torxed May 26 '14 at 12:56

3 Answers3

2

This is actually built in to the Python standard library (I've never been exactly sure why, it's a bit of a random piece of functionality).

import webbrowser
webbrowser.open(my_url)
Daniel Roseman
  • 541,889
  • 55
  • 754
  • 786
1

One option would be to launch Firefox using selenium and interact with it using WebDriver API:

from selenium import webdriver

driver = webdriver.Firefox()
driver.get(url)
alecxe
  • 414,977
  • 106
  • 935
  • 1,083
0

Combine this other answer in stackoverflow with this from mozilla's forum and you get:

from subprocess import call
call(["firefox", "http://your_url"])
Community
  • 1
  • 1
jspurim
  • 896
  • 8
  • 23
  • I think this needs firefox to be run first –  May 26 '14 at 13:15
  • @begueradj Why you say so? I can't find that in mozilla documentation. I don't have firefox installed in this machine to test it. – jspurim May 26 '14 at 13:18