summaryrefslogtreecommitdiffstats
path: root/g4f/webdriver.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-02-09 14:24:15 +0100
committerGitHub <noreply@github.com>2024-02-09 14:24:15 +0100
commit5c75972c50ac936cb6dc8e01cef9cdb08daa8ed7 (patch)
tree739dc1c020fcaff53d3f80630036b9aa2ac94f54 /g4f/webdriver.py
parentMerge pull request #1565 from hlohaus/gemini (diff)
downloadgpt4free-5c75972c50ac936cb6dc8e01cef9cdb08daa8ed7.tar
gpt4free-5c75972c50ac936cb6dc8e01cef9cdb08daa8ed7.tar.gz
gpt4free-5c75972c50ac936cb6dc8e01cef9cdb08daa8ed7.tar.bz2
gpt4free-5c75972c50ac936cb6dc8e01cef9cdb08daa8ed7.tar.lz
gpt4free-5c75972c50ac936cb6dc8e01cef9cdb08daa8ed7.tar.xz
gpt4free-5c75972c50ac936cb6dc8e01cef9cdb08daa8ed7.tar.zst
gpt4free-5c75972c50ac936cb6dc8e01cef9cdb08daa8ed7.zip
Diffstat (limited to '')
-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}")