这是我的代码:(我使用
seleniumbase
访问网站)
from seleniumbase import SB, Driver
import time
with SB(uc=True, test=True) as sb:
url = "https://ahrefs.com/website-authority-checker"
sb.driver.uc_open_with_reconnect(url, 3)
sb.type('/html/body/div/div[1]/section[1]/div/div/div/div/div/div[2]/div[2]/div[2]/form/div/div/div[1]/div/input', 'https://www.peopleperhour.com')
time.sleep(2)
sb.click('/html/body/div/div[1]/section[1]/div/div/div/div/div/div[2]/div[2]/div[2]/form/div/button')
time.sleep(10)
sb.post_message("SeleniumBase wasn't detected", duration=4)
我正在尝试获取一些与网站强度相关的统计数据(dr、反向链接、linking_websites),但 cloudflare 验证码妨碍了,即使我使用的是 seleniumbase。这是我了解 seleniumbase 的视频链接: https://www.youtube.com/watch?v=5dMFI3e85ig
这是适用于该页面的完整 SeleniumBase 脚本:
from seleniumbase import SB
with SB(uc=True, test=True, locale_code="en") as sb:
url = "https://ahrefs.com/website-authority-checker"
sb.driver.uc_open_with_reconnect(url, 4)
sb.type('input[placeholder="Enter domain"]', "https://www.peopleperhour.com")
sb.driver.uc_click('span:contains("Check Authority")', reconnect_time=4)
breakpoint()
键入
c
并按 Enter
从 breakpoint()
继续。