Мне нужна помощь. Есть исходная страница:
<html lang="en"><head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>יד 2</title>
<link data-n-head="true" data-hid="icon_16x16" rel="icon" type="image/png" href="//assets.yad2.co.il/yad2site/y2assets/images/16px.png" sizes="16x16">
<link rel="stylesheet" type="text/css" href="https://captcha-assets.yad2.co.il/style.css">
</head>
<body>
<div class="wrapper">
<header>
<nav>
<a href="javascript:void(0)" class="logo-wrapper">
<img src="https://captcha-assets.yad2.co.il/images/yad2Logo.png">
</a>
<div class="actions">
<a href="//my.yad2.co.il/newOrder/index.php" class="link">
<i class="y2i_plus"></i>
<span class="icon_text new_ad">פרסום מודעה חדשה</span>
</a>
</div>
</nav>
</header>
<div class="container">
<div class="content">
<p>לצרכי אבטחת האתר נרצה לוודא שיש מישהו מאחורי המסך.<br>נבקש שתסמן שאינך רובוט</p>
<img src="https://captcha-assets.yad2.co.il/images/robot.svg">
</div>
<div class="captcha-wrapper">
<div id="captcha">
<form action="" method="POST" style="width:300px;margin-left:auto;margin-right:auto;">
<script type="text/javascript" async="" src="https://www.gstatic.com/recaptcha/releases/wk6lx42JIeYmEAQSHndnyT8Q/recaptcha__en.js"></script><script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=en"></script>
<div class="g-recaptcha" data-sitekey="6LeH3loUAAAAAI_m15sXabjr8-Iqj2yI3F3JeK8X"><div style="width: 304px; height: 78px;"><div><iframe src="https://www.google.com/recaptcha/api2/anchor?ar=1&k=6LeH3loUAAAAAI_m15sXabjr8-Iqj2yI3F3JeK8X&co=aHR0cHM6Ly92YWxpZGF0ZS5wZXJmZHJpdmUuY29tOjQ0Mw..&hl=en&v=wk6lx42JIeYmEAQSHndnyT8Q&size=normal&cb=k65b308zmihn" width="304" height="78" role="presentation" name="a-magkr27wpg0l" frameborder="0" scrolling="no" sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation allow-modals allow-popups-to-escape-sandbox"></iframe></div><textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid rgb(193, 193, 193); margin: 10px 25px; padding: 0px; resize: none; display: none;"></textarea></div><iframe style="display: none;"></iframe></div>
<input type="hidden" id="recaptcha_response" name="recaptcha_response"><br>
<center><br><input type="submit" class="btn btn-success btn-sm" value="Submit"><br></center>
</form>
</div>
</div>
<br>
<div class="captcha-wrapper">
<div id="ref">
Captcha Digest :<b>60e873912134b72fc97337909bcadc1c7d244af1</b>
</div>
</div>
</div>
</div>
<div style="background-color: rgb(255, 255, 255); border: 1px solid rgb(204, 204, 204); box-shadow: rgba(0, 0, 0, 0.2) 2px 2px 3px; position: absolute; transition: visibility 0s linear 0.3s, opacity 0.3s linear 0s; opacity: 0; visibility: hidden; z-index: 2000000000; left: 0px; top: -10000px;"><div style="width: 100%; height: 100%; position: fixed; top: 0px; left: 0px; z-index: 2000000000; background-color: rgb(255, 255, 255); opacity: 0.05;"></div><div class="g-recaptcha-bubble-arrow" style="border: 11px solid transparent; width: 0px; height: 0px; position: absolute; pointer-events: none; margin-top: -11px; z-index: 2000000000;"></div><div class="g-recaptcha-bubble-arrow" style="border: 10px solid transparent; width: 0px; height: 0px; position: absolute; pointer-events: none; margin-top: -10px; z-index: 2000000000;"></div><div style="z-index: 2000000000; position: relative;"><iframe title="recaptcha challenge" src="https://www.google.com/recaptcha/api2/bframe?hl=en&v=wk6lx42JIeYmEAQSHndnyT8Q&k=6LeH3loUAAAAAI_m15sXabjr8-Iqj2yI3F3JeK8X&cb=aiizkxqhhp5p" name="c-magkr27wpg0l" frameborder="0" scrolling="no" sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation allow-modals allow-popups-to-escape-sandbox" style="width: 100%; height: 100%;"></iframe></div></div></body></html>
У меня есть успех, нажав на флажок, но я не понимаю, как я нажимаю кнопку исключения и затем нажимаю кнопку отправки, это процесс, который мне нужен go я добавил несколько изображений, чтобы вы, ребята, поняли, как происходит процесс
нажмите на поле ввода капчи https://prnt.sc/s9pou9, это работает
нажмите на расширение значок: https://prnt.sc/s9ppbs - не удалось
нажмите на кнопку подтверждения в конце: https://prnt.sc/s9ppn5 - не удалось
это мой исходный код:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import json
import os
os.system('taskkill /im chrome.exe')
driver_path = Path("chromedriver.exe")
user_data_dir = Path(r"C:\Users\osher\AppData\Local\Google\Chrome\User Data")
options = webdriver.ChromeOptions()
options.add_argument("--user-data-dir={}".format(user_data_dir))
options.add_argument('--profile-directory=Default')
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(chrome_options=options, executable_path=r'chromedriver.exe')
driver.get("https://www.yad2.co.il/api/pre-load/getFeedIndex/vehicles/private-cars?model=1645&page=0")
driver.find_element_by_xpath('//*[@id="captcha"]/form/div[1]').click()
driver.find_element_by_xpath('//*[@id="captcha"]/form/div[1]/div/div/div[1]').click()
driver.execute_script("return arguments[0].scrollIntoView(true);", WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div.g-recaptcha#captcha-form"))))
WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframe[src^='https://www.google.com/recaptcha/api2/anchor']")))
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "span#recaptcha-anchor"))).click()