You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes Google shows a CAPTCHA. Something like this would check and wait until manually solved.
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# Define a function to check if CAPTCHA is present on the page
def is_captcha_present(xpath_captcha)
):
try:
captcha_element = driver.find_element(By.XPATH, xpath_captcha]') # Adjust this XPath to match the CAPTCHA container on your target website
return captcha_element.is_displayed()
except:
return False
# Check if CAPTCHA is present
xpath_captcha = '//div[contains(@class, "captcha-container")
if is_captcha_present(xpath_captcha):
print("CAPTCHA detected. Please solve it to proceed.")
# Wait for the user to complete the CAPTCHA
WebDriverWait(driver, 3600).until_not(EC.presence_of_element_located((By.XPATH, xpath_captcha))) # Adjust this XPath to match the CAPTCHA container on your target website
print("CAPTCHA solved successfully. Proceeding with scraping.")
The text was updated successfully, but these errors were encountered:
Sometimes Google shows a CAPTCHA. Something like this would check and wait until manually solved.
The text was updated successfully, but these errors were encountered: