InstaPy / InstaPy

📷 Instagram Bot - Tool for automated Instagram interactions
GNU General Public License v3.0
16.85k stars 3.77k forks source link

firefox_profile issue #6716

Open jvftw opened 1 year ago

jvftw commented 1 year ago

InstaPy Version: 0.6.16 .. .. .. .. .. .. .. .. ._. Workspace in use: "C:/Users/USER/InstaPy" Traceback (most recent call last): File "c:\Users\USER\Desktop\Stuff\instapy\quickstart.py", line 25, in session = InstaPy(username=insta_username, File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\instapy\instapy.py", line 330, in init self.browser, err_msg = set_selenium_local_session( File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\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'

alirezaunix commented 1 year ago

same issue!!

lejtdan commented 1 year ago

Same issue as well

mk1995 commented 1 year ago

Its like instapy needs upgrade regarding browser.py as well. Here I have fixed the issue as following:

# firefox_profile.update_preferences() 
firefox_options.profile = firefox_profile
# prefer user path before downloaded one
driver_path = geckodriver_path or get_geckodriver()
ser = FirefoxService(executable_path=driver_path, log_path=geckodriver_log) # we can use webdriver manager as well
browser = webdriver.Firefox(
    # firefox_profile=firefox_profile, # delete this line of code.
    service=ser,
    options=firefox_options,
)
sekoakb commented 1 year ago

still not working. leads to NameError: name 'FirefoxService' is not defined this time.

EnkrateiaLucca commented 1 year ago

still not working. leads to NameError: name 'FirefoxService' is not defined this time.

Mine worked using this: firefox_options.profile = firefox_profile

geckodriver log in specific user logfolder

geckodriver_log = "{}geckodriver.log".format(logfolder)
# prefer user path before downloaded one
driver_path = geckodriver_path or get_geckodriver()
firefox_options.executable_path=driver_path
firefox_options.log_path=geckodriver_log

browser = webdriver.Firefox(
    options=firefox_options,
)
asadullahqb commented 1 year ago

I'm stuck on this same issue too.

Xehia commented 1 year ago

Basically from selenium4 firefox_profile has been deprecated.

So you have 2 ways to fix this:

Downgrade selenium

pip uninstall selenium
pip install selenium==3.141.0

Update the code

In browser.py

from selenium.webdriver.firefox.service import Service

# Code from imports to line 122

firefox_options.profile = firefox_profile
service = Service(executable_path=driver_path)

browser = webdriver.Firefox(
    service=service,
    options=firefox_options,
)