Skip to content

Instantly share code, notes, and snippets.

@littleironical
Last active November 28, 2020 08:20
Show Gist options
  • Save littleironical/c92e106c1e3a800bcabcf72406875f95 to your computer and use it in GitHub Desktop.
Save littleironical/c92e106c1e3a800bcabcf72406875f95 to your computer and use it in GitHub Desktop.
### Problem 1. 'chromedriver.exe' executable needs to be in PATH.
# First install webdriver-manager
pip install webdriver-manager
# Then import ChromeDriverManager
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
# This will automatically update the driver
# No need to specify the path in this case
driver = webdriver.Chrome(ChromeDriverManager().install())
...
### Problem 2. selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element:
# This is a race condition where the 'find element' is executing before it is present on the page
# The line below will wait for 1 second and then continue the code
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment