WebDriver.__init__() got an unexpected keyword argument 'firefox_profile'

2.5k Views Asked by At

I'm trying to create a instagram bot using instapy however I keep runnning into this error.

This is my code:

from instapy import InstaPy

session = InstaPy(username = "username", password = "password")
session.login()

session.set_relationship_bounds(enabled = True, max_followers = 1000)

session.set_do_follow(True, percentage=100)
session.like_by_tags(["clothingbrand","clothing","fashion"], amount = 3)
session.set_dont_like(["nsfw"])


session.end()

And this is the error:

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

I've been looking for this solution for hours however nobody has seemed to be able to find a viable solution. Does anyone know how to fix this?

2

There are 2 best solutions below

1
Alessandro Borile On

The problem is that Selenium package removed the firefox_profile argument in the last release. The 4.9.0 still support it.

1
Natascha Fritschle On

Just use

pip uninstall selenium
pip install selenium==4.9.0