Skip to content

Instantly share code, notes, and snippets.

@kipkitur
Last active August 15, 2020 00:00
Show Gist options
  • Save kipkitur/fca678992552a0c595dd443f8b045544 to your computer and use it in GitHub Desktop.
Save kipkitur/fca678992552a0c595dd443f8b045544 to your computer and use it in GitHub Desktop.
# import modules
from selenium import webdriver
from selenium.webdriver.common.by import By
import pytest
# we will use Google Chrome in this test. Specify the location of your chromedriver.exe
webdriver_location = "\\Users\\user\\Downloads\\chromedriver_win32\\chromedriver.exe"
# the webpage we want to access for our test
webpage_link = "https://www.example.com/"
# Use fixtures to define the code to run before and after tests
# Replace line 17 with your desired webdriver and webdriver location
@pytest.fixture
def browser_setup():
browser = webdriver.Chrome(webdriver_location)
browser.maximize_window()
browser.implicitly_wait(10)
yield browser
browser.quit()
@kipkitur
Copy link
Author

changed line number for webdriver location in pytest fixture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment