If you want to play along with the demos, do this:

Confirm you have both Firefox and Chrome installed. Confirm that chromedriver is in your PATH (typing which chromedriver in a Terminal will tell you if so).

py.test & Selenium

mike warren
aka meejah
https://meejah.ca

py.test & Selenium

py.test & Selenium

py.test & Selenium

from selenium.webdriver import Firefox
driver = Firefox()
driver.get('https://github.com')
search_box = driver.find_element_by_name('q')
search_box.send_keys('txtorcon')
search_box.submit()
found_repos = driver.find_elements_by_class_name(
    'repo-list-name'
)
repo_names = [div.text for div in found_repos]
assert 'meejah/txtorcon' in repo_names
import pytest
from selenium.webdriver import Firefox
@pytest.fixture
def driver():
    return Firefox()
def test_github_search(driver):
    driver.get('https://github.com')
    search_box = driver.find_element_by_name('q')
    search_box.send_keys('txtorcon')
    search_box.submit()
    found_repos = [
        repo.text for repo in
        driver.find_elements_by_class_name('repo-list-name')
    ]
    assert 'meejah/txtorcon' in found_repos

Demo