24 lines
497 B
Python
24 lines
497 B
Python
import os
|
|
|
|
from selenium import webdriver
|
|
|
|
class SeleniumTest:
|
|
def __init__(self, src, drive_path):
|
|
self.driver = webdriver.Chrome(executable_path=drive_path)
|
|
|
|
self.driver.get(src)
|
|
|
|
def __del__(self):
|
|
self.driver.close()
|
|
|
|
def assert_title(self, title):
|
|
assert title in self.driver.title
|
|
|
|
|
|
if __name__ == '__main__':
|
|
drive_path = "%s/chromedriver" % os.getcwd()
|
|
|
|
st = SeleniumTest("https://python.org", drive_path)
|
|
st.assert_title("Python")
|
|
|