summaryrefslogtreecommitdiffstats
path: root/g4f/webdriver.py
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/webdriver.py')
-rw-r--r--g4f/webdriver.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/g4f/webdriver.py b/g4f/webdriver.py
index d28cd97b..b54fae15 100644
--- a/g4f/webdriver.py
+++ b/g4f/webdriver.py
@@ -9,6 +9,7 @@ try:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
+ from selenium.common.exceptions import NoSuchElementException
has_requirements = True
except ImportError:
from typing import Type as WebDriver
@@ -120,6 +121,8 @@ def bypass_cloudflare(driver: WebDriver, url: str, timeout: int) -> None:
WebDriverWait(driver, 5).until(
EC.presence_of_element_located((By.CSS_SELECTOR, "#challenge-stage input"))
).click()
+ except NoSuchElementException:
+ ...
except Exception as e:
if debug.logging:
print(f"Error bypassing Cloudflare: {e}")