英文:
Can't go past Cloudflare's verify you are human check even after clicking the check box multiple times when using Selenium
问题
我无法通过这个检查。即使我点击,它也会返回到这个状态。
我尝试过使用:
- 浏览器数据和配置文件,以确保所有历史记录、Cookie 和缓存都存在,但仍然无法解决问题。
- 不使用配置文件和数据。
- 运行 Chromium 浏览器并使用 --remote-debugging-port,然后将 selenium 连接到它。
在这三种情况下都失败了。
如果我在同一个 selenium 会话中手动复制链接,然后粘贴到新标签页中,然后再单击复选框,它就可以工作。
from os import path
from time import sleep
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
chrome_options = Options()
chrome_options.add_argument("profile-directory=Default")
chrome_options.add_argument("user-data-dir=/home/abhishek/.config/chromium/")
chrome_options.binary_location = "/usr/bin/chromium"
chrome_options.add_argument("user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.79")
try:
driver = Chrome(options=chrome_options,
service=Service(executable_path=path.join("/home", "abhishek", "opt",
"chromedriver_linux", "chromedriver")))
driver.maximize_window()
driver.get("https://etherscan.io")
sleep(5)
input_box = driver.find_element(By.ID, "search-panel")
input_box.click()
sleep(1)
input_box.send_keys("0x896463c65b70da9bbe267c2feb97ab59fc715506")
sleep(5)
driver.find_element(By.CSS_SELECTOR, "div.flex-fill.text-truncate").click()
sleep(6)
driver.find_element(By.ID, "dropdownMenuBalance").click()
sleep(2)
driver.execute_script("window.scrollBy(0, 450)")
sleep(1)
driver.find_element(By.XPATH, "//i[@class='far fa-wallet me-1']").click()
sleep(20)
except Exception as e:
print("OUT", e)
driver.close()
请帮忙。
英文:
I am unable to get past this check. Even though I click it goes back to this state.
I tried using:
- Browsers data and profile so that all the history, cookie and cache is present but still
- Without using profile and data
- By running Chromium browser on using --remote-debugging-port and connecting selenium to it.
It is failing in all 3.
If I copy the link manually in the same selenium session and paste in new tab and then click the check box it works.
from os import path
from time import sleep
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
chrome_options = Options()
chrome_options.add_argument("profile-directory=Default")
chrome_options.add_argument("user-data-dir=/home/abhishek/.config/chromium/")
chrome_options.binary_location = "/usr/bin/chromium"
chrome_options.add_argument("user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.79")
try:
driver = Chrome(options=chrome_options,
service=Service(executable_path=path.join("/home", "abhishek", "opt",
"chromedriver_linux", "chromedriver")))
driver.maximize_window()
driver.get("https://etherscan.io")
sleep(5)
input_box = driver.find_element(By.ID, "search-panel")
input_box.click()
sleep(1)
input_box.send_keys("0x896463c65b70da9bbe267c2feb97ab59fc715506")
sleep(5)
driver.find_element(By.CSS_SELECTOR, "div.flex-fill.text-truncate").click()
sleep(6)
driver.find_element(By.ID, "dropdownMenuBalance").click()
sleep(2)
driver.execute_script("window.scrollBy(0, 450)")
sleep(1)
driver.find_element(By.XPATH, "//i[@class='far fa-wallet me-1']").click()
sleep(20)
except Exception as e:
print("OUT", e)
driver.close()
Please help
答案1
得分: 1
这是因为Selenium交互仍然被视为机器人,而您的CAPTCHA也会注意到鼠标是如何移动到复选框区域的。因此,您需要使用CAPTCHA绕过工具,如2captcha、anti-captcha等。
英文:
This is because Selenium interaction is yet of a bot and your CAPTCHAs also notice how the mouse is being moved towards the checkbox area. So you will be required to use CAPTCHA bypassers like 2captcha, anti-captcha, etc.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论