Advertisement
Guest User

Untitled

a guest
Jan 31st, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. from pyvirtualdisplay import Display
  2. from selenium import webdriver
  3.  
  4. import sys
  5. sys.path.append("/home/sgalkov/browsermob-proxy-py/")
  6. from browsermobproxy import Server
  7.  
  8. server = Server("/home/sgalkov/browsermob/browsermobproxy/bin/browsermob-proxy")
  9. server.start()
  10. proxy = server.create_proxy()
  11. proxy.new_har("w3")
  12.  
  13. #initialize HIDDEN display
  14. display = Display(visible=0, size=(800, 600))
  15. display.start()
  16.  
  17. #initialize webdriver
  18. browser = webdriver.Firefox()
  19.  
  20. browser.get('http://www.w3.org')
  21. print browser.title
  22. print proxy.har()
  23.  
  24. browser.quit() #important, or else loaded browser will remain running as a bg proc!
  25. display.stop()
  26. server.stop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement