Oreborous

Selenium Python

Feb 2nd, 2019
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. from selenium import webdriver
  2. from selenium.webdriver.common.keys import Keys
  3.  
  4. options = webdriver.ChromeOptions()
  5.  
  6. # Download chromedriver from https://chromedriver.storage.googleapis.com/index.html?path=2.46/
  7. browser = webdriver.Chrome(executable_path='./chromedriver.exe', options=options)
  8.  
  9. browser.get('http://www.google.com')
  10. assert 'Google' in browser.title
  11.  
  12. elem = browser.find_element_by_css_selector('input[type=text]')
  13. elem.send_keys('this is my test' + Keys.RETURN)
  14.  
  15. browser.quit()
Advertisement
Add Comment
Please, Sign In to add comment