Selenium

import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
 
#driver = webdriver.Chrome()
 
chromedriver = '/Users/vital/Downloads/chromedriver'
os.environ['webdriver.chrome.driver'] = chromedriver
driver = webdriver.Chrome(chromedriver)
 
driver.get('http://www.python.org')
assert 'Python' in driver.title
elem = driver.find_element_by_name('q')
elem.clear()
elem.send_keys('pycon')
#elem.send_keys(Keys.RETURN)
button = driver.find_element_by_name('submit')
button.click()
assert 'No results found.' not in driver.page_source
#driver.close()

Run this script in command line to install Selenium:
pip install -U selenium

  1. Selenium for Python documentation

Leave a Reply

Your email address will not be published. Required fields are marked *