【问题标题】:How to use tor with selenium-webdriver in python in a windows machine?如何在 Windows 机器中的 python 中将 tor 与 selenium-webdriver 一起使用?
【发布时间】:2019-08-24 02:33:14
【问题描述】:

我希望能够编写一个 Instagram 机器人来自动评论图片。 我已经弄清楚了正常的机器人部分,但我不知道如何使用 tor webdriver,所以我将能够定期更改我的 IP 地址,因此 instagram 将无法阻止我。

from tbselenium.tbdriver import TorBrowserDriver
with TorBrowserDriver(r"\\C:\\Users\\simon\\Desktop\\Tor Browser\\Browser\\TorBrowser") as driver:
    driver.get("https://www.google.com")

我试过了,但它说:

tbselenium.exceptions.TBDriverPathError: TBB path is not a directory \\C:\\Users\\simon\\Desktop\\Tor Browser\\Browser\\TorBrowser\\

感谢任何答案! :)

编辑:

from tbselenium.tbdriver import TorBrowserDriver 
with TorBrowserDriver(r"\\C:\\Users\\simon\\Desktop\\Tor Browser\\Browser\\TorBrowser") as driver: 
driver.get("google.com") 

tbselenium.exceptions.TBDriverPathError: TBB path is not a directory \\C:\\Users\\simon\\Desktop\\Tor Browser\\Browser\\TorBrowser\\

【问题讨论】:

    标签: python windows selenium-webdriver selenium-chromedriver tor


    【解决方案1】:

    tbselenium 不适合你,因为兼容性,看项目描述https://github.com/webfp/tor-browser-selenium。不支持 Windows 和 macOS。

    【讨论】:

    • 鼓励链接到外部资源,但请在链接周围添加上下文,以便您的其他用户了解它是什么以及为什么存在。始终引用重要链接中最相关的部分,以防目标站点无法访问或永久离线。请参阅:How to anwser
    【解决方案2】:

    标准的selenium 包无法做到这一点。

    您可以尝试使用this github存储库,可以使用pip install tbselenium安装

    注意我自己没有尝试过。

    【讨论】:

    • 你能用你试过的代码更新你的问题吗?
    • 这是问题 from tbselenium.tbdriver import TorBrowserDriver with TorBrowserDriver(r"\\C:\\Users\\simon\\Desktop\\Tor Browser\\Browser\\TorBrowser") as司机:driver.get("google.com")
    • 请不要在 cmets 中发布代码!我使用您提供的代码编辑了您的问题。
    • 另外,您在运行此代码时遇到了什么错误?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-19
    • 1970-01-01
    • 2018-04-19
    • 2013-10-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多