python WebDriver.__init__()获得了意外的关键字参数'firefox_profile'

dxxyhpgq  于 2024-01-05  发布在  Python
关注(0)|答案(2)|浏览(152)

我试图创建一个Instagram的机器人使用installation,但我一直运行到这个错误。
这是我的代码:

  1. from instapy import InstaPy
  2. session = InstaPy(username = "username", password = "password")
  3. session.login()
  4. session.set_relationship_bounds(enabled = True, max_followers = 1000)
  5. session.set_do_follow(True, percentage=100)
  6. session.like_by_tags(["clothingbrand","clothing","fashion"], amount = 3)
  7. session.set_dont_like(["nsfw"])
  8. session.end()

字符串
这就是错误:

  1. Workspace in use: "C:/Users/1/InstaPy"
  2. Traceback (most recent call last):
  3. File "C:\Instagram\instagram_bot.py", line 3, in <module>
  4. session = InstaPy(username = "username", password = "password")
  5. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  6. File "C:\Users\1\AppData\Local\Programs\Python\Python311\Lib\site-packages\instapy\instapy.py", line 330, in __init__
  7. self.browser, err_msg = set_selenium_local_session(
  8. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  9. File "C:\Users\1\AppData\Local\Programs\Python\Python311\Lib\site-packages\instapy\browser.py", line 123, in set_selenium_local_session
  10. browser = webdriver.Firefox(
  11. ^^^^^^^^^^^^^^^^^^
  12. TypeError: WebDriver.__init__() got an unexpected keyword argument 'firefox_profile'


我一直在寻找这个解决方案几个小时,但似乎没有人能够找到一个可行的解决方案。有人知道如何解决这个问题吗?

7uhlpewt

7uhlpewt1#

问题是Selenium包在上一个版本中删除了firefox_profile参数。4.9.0仍然支持它。

ih99xse1

ih99xse12#

只是用

  1. pip uninstall selenium
  2. pip install selenium==4.9.0

字符串

相关问题