Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pyvirtualdisplay import Display
- from selenium import webdriver
- import sys
- sys.path.append("/home/sgalkov/browsermob-proxy-py/")
- from browsermobproxy import Server
- server = Server("/home/sgalkov/browsermob/browsermobproxy/bin/browsermob-proxy")
- server.start()
- proxy = server.create_proxy()
- proxy.new_har("w3")
- #initialize HIDDEN display
- display = Display(visible=0, size=(800, 600))
- display.start()
- #initialize webdriver
- browser = webdriver.Firefox()
- browser.get('http://www.w3.org')
- print browser.title
- print proxy.har()
- browser.quit() #important, or else loaded browser will remain running as a bg proc!
- display.stop()
- server.stop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement