Answer the question
In order to leave comments, you need to log in
Why is the get method not working in the code?
In fact, this code should open a page on YouTube.
from selenium import webdriver
def main():
driver = webdriver.Chrome()
driver.get("https://www.youtube.com/")
main()
Answer the question
In order to leave comments, you need to log in
add page wait
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()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question