Skip to content

Commit

Permalink
Return driver object only when valid
Browse files Browse the repository at this point in the history
Without this, a driver that failed the sanity check could be returned. This leads to attempting to use it when checking URLs, which led to avoidable failures.

Fixes urlstechie#92
  • Loading branch information
mabraham authored Oct 9, 2024
1 parent d0e7560 commit a582038
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions urlchecker/core/urlproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,11 @@ def get_driver(self, port: Optional[int] = None, timeout: Optional[int] = 5):
try:
from .webdriver import WebDriver

driver = WebDriver(port=port, timeout=timeout)
default_driver = WebDriver(port=port, timeout=timeout)

# Do a sanity check of the driver
driver.check("https://google.com")
# Do a sanity check of the default driver
default_driver.check("https://google.com")
driver = default_driver
except:
logger.warning(
"Issue with driver, results will be improved if you have it! Please match your version from https://googlechromelabs.github.io/chrome-for-testing"
Expand Down

0 comments on commit a582038

Please # to comment.