Advertisement
metalx1000

Python Interact with Firefox

Aug 12th, 2017
693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. #install
  2. sudo aptitude install firefoxdriver python-selenium
  3.  
  4. #useage
  5. from selenium import webdriver
  6. #define driver- firefox, chrome  or phantomjs etc.
  7. driver = webdriver.Firefox()
  8. #Open the url
  9. driver.get('https://www.google.com')
  10. #see how javascript simple alert is being executed
  11. driver.execute_script("alert('hello world');")
  12. #close the driver  i.e. closing opened Firefox instance!
  13. driver.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement