I am trying to make a Python script that simply kicks me off of facebook after 10 minutes, any ideas on the best way to either terminate the browser or even better URL opened specifically?
#Stay on facebook for 10 minute session
import time
import webbrowser
import sys
webbrowser.open("http://www.facebook.com/")
time.sleep(600)
#terminate session here
sys.exit()
Thanks for the help!
You’d open the URL, determine what browser is was opened with, then kill it (via
os.killor similar).Not sure how to do it with the
webbrowsermodule, but since I guess you’re not distributing the script, you could instead open a hardcoded browser viasubprocess, e.g Firefox: