2 个回答
0
这个方法有效!
from seleniumbase import Driver
import time
driver = Driver(uc=True, incognito=True)
driver.get(url)
0
描述:
如果你在使用Chrome浏览器,可以简单地下载 undetected-chromedriver
这个包,还有requests,然后在无头模式下运行Chrome驱动。
步骤:
使用以下命令安装requests和undetected-chromedriver:
pip install requests undetected-chromedriver
然后在你的代码中使用以下内容:
import undetected_chromedriver as webdriver
options = webdriver.ChromeOptions()
options.add_argument("--headless")
options.add_argument("--use_subprocess")
driver = webdriver.Chrome(options=options)
driver.get("https://example.com")
试试看,这样就可以顺利运行了。