【问题标题】:Can't get webpage to load when on Selenium Chrome Driver and tried years old solutions, need new one使用 Selenium Chrome 驱动程序并尝试多年的解决方案时无法加载网页,需要新的解决方案
【发布时间】:2021-09-20 15:32:06
【问题描述】:

我需要帮助构建一个使用 python selenium chrome 驱动程序绕过 gumtree.com.au 登录页面的机器人。当chrome驱动进入指定页面时

https://www.gumtree.com.au/t-login-form.html

它什么都不加载,只是一个空白页。但是,当我手动将其插入任何浏览器时,它会完美加载。我根本无法登录让它加载硒铬驱动程序,我尝试更改标题,使用无头驱动程序,并使用 vim 全局更改所有 cdc_ 文本(是的,它是正确的,我已经三重检查了)。

使用了这个useragent类(实际上要导入包fake-useragent):

from fake_useragent import UserAgent

无头驱动程序片段:

options.add_argument(f'user-agent={random_header}')
options.add_argument("--window-size=1920,1080")
options.add_argument('--ignore-certificate-errors')
options.add_argument('--allow-running-insecure-content')
options.add_argument("--disable-extensions")
options.add_argument("--proxy-server='direct://'")
options.add_argument("--proxy-bypass-list=*")
options.add_argument("--start-maximized")
options.add_argument('--disable-gpu')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--no-sandbox')
options.add_argument(f"user-agent={random_header}")

几个问题:

  1. 我该怎么办?也可以使用其他自动化工具。
  2. 如何构建一个在大多数网站(如果不是全部)都无法检测到的机器人? 尤其是那些试图防止刮擦的(我不是 刮,我只是假设他们得到最糟糕的)

【问题讨论】:

    标签: python python-3.x selenium-webdriver selenium-chromedriver bots


    【解决方案1】:

    找到解决办法——我必须先让驱动访问主页,休眠 5 秒,然后跳转到登录页面。如果机器人直接进入登录页面,则没有负载。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-05
      • 2023-03-22
      • 2017-10-02
      • 1970-01-01
      • 2016-03-31
      • 1970-01-01
      • 1970-01-01
      • 2023-01-26
      相关资源
      最近更新 更多