【问题标题】:How to dont get webdriver detected?如何不检测到 webdriver?
【发布时间】:2021-01-17 11:59:39
【问题描述】:

今天我用 Selenium 编写了我的第一个 Python 脚本。当我使用 Chrome 或 Edge 网络驱动程序时,我总是得到一个小横幅,说我正在使用网络驱动程序。所以它被检测到了。许多网站阻止这些或不允许他们在网站上做任何事情。有什么简单的方法不让驱动程序不被检测到?

谢谢

我的代码:

from selenium.webdriver.common.keys import Keys
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
from tkinter import *

path = "C:\Program Files (x86)\msedgedriver.exe"
driver = webdriver.Edge(path)

driver.get("https://youtube.de")
print(driver.title)

time.sleep(10)
driver.quit()

【问题讨论】:

  • 请编辑问题并澄清最后一句话。

标签: python google-chrome webdriver bots


【解决方案1】:

尝试使用ChromeDriver

将chromedriver.exe保存在工作目录中。

    options = webdriver.ChromeOptions()
    options.add_argument('--headless') #If you need HeadLess mod
    options.add_argument("--ignore-certificate-errors")
    browser = webdriver.Chrome(options=options)
    browser.get(link)

【讨论】:

  • 感谢您的帮助,但我现在如何才能获得其中的路径。如果我把它放在 options=options 我得到一个错误。
  • 选项(参数)=选项(类实例)
猜你喜欢
  • 2020-08-25
  • 1970-01-01
  • 1970-01-01
  • 2014-05-14
  • 2016-06-14
  • 1970-01-01
  • 1970-01-01
  • 2014-09-16
  • 2018-03-22
相关资源
最近更新 更多