Using Python to start a browser (Chromium) and change the url
I am trying to write a script that makes it possible to change the url of an active process.
So for instance, I am starting my browser using:
browser = Popen(["chromium", "http://www.google.com"])
After an X interval I want to change the url of browser.
I've tried allot of things to get this result but nothing has succeeded so far. (stdin.write / put (PIPE) etc etc.).
browser = sh.Command('uzbl-browser')(print_events=True, config='-', uri=current_browser_url, _bg=True) browser.process.stdin.put('uri http://www.google.nl' + '\n')
I'm hoping you can help me out with this.
if you work with browsers + python, you'll probably want to take a look at Selenium. It's not copy-paste but you can learn it in couple of hours...
I recommend using selenium to automate this process although you could use webbrowser too:
from selenium.webdriver import *; chrome = Chrome() # create browser chrome.get('http://www.google.com')