как нажать на галочку: "я не робот" при парсинге ozon, selenium
при парсинге ozon.ru спустя некоторое время появляется рекапча. нужно нажать на эту галочку, но почему-то selenium не видит этот обьект. не могу понять, почему (полагаю надо переключится на нужный фрейм). вот подобная статейка: https://stackoverflow.com/questions/53917157/find-the-recaptcha-element-and-click-on-it-python-selenium
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_argument('disable-infobars')
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
# options.add_argument("user-data-dir=C:\\Users\\andrey\\AppData\\Local\\Google\\Chrome\\User Data")
driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
# driver.get("https://www.ozon.ru/category/telefony-i-smart-chasy-15501/?sorting=price")
while True:
time.sleep(1)
driver.get("https://www.ozon.ru/category/telefony-i-smart-chasy-15501/?sorting=price")
titles = driver.find_elements_by_xpath("//a[contains(@class, 'a2g0 tile-hover-target')]")
print(len(titles))
if len(titles) == 0:
# WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.ID, "main-iframe")))
# WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR, "iframe[name^='a-'][src^='https://www.google.com/recaptcha/api2/anchor?']")))
# WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//span[@class='recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox']/div[@class='recaptcha-checkbox-border']"))).click()
time.sleep(999)
