from selenium import webdriver
def main():
driver = webdriver.Chrome()
driver.get("https://www.youtube.com/")
main()
url = 'https://www.youtube.com/'
title = 'YouTube'
driver = webdriver.Chrome()
driver.get(url)
try:
# https://selenium-python.readthedocs.io/waits.html
WebDriverWait(driver,10).until(EC.title_contains(title))
except (NoAlertPresentException, TimeoutException) as e:
print('page was not shown: {0}'.format(e))
finally:
driver.quit()