1

Hello Guys I'm having problem on my code.

from selenium import webdriver
import time

profile = webdriver.FirefoxProfile()
profile.set_preference('network.proxy_type',1)
profile.set_preference('network.proxy.http',"91.xx.xxx.xx")
profile.set_preference('network.proxy.http_port',xxxx)
# profile.update_preference()  ---> this code letter giving the error.
driver = webdriver.Firefox(firefox_profile=profile)
driver.get('http://whatismyipaddress.com')
time.sleep(3)
driver.close()

Here Is The Error I'm Getting:

AttributeError: 'FirefoxProfile' object has no attribute 'update'

I cant figure out the problem i just want to save the profile settings to use.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

2 Answers2

1

I Think You Need To Change This

profile.update_preference()

With This:

profile.update_preferences()
Hamza Lachi
  • 1,046
  • 7
  • 25
1

update_preferences()

update_preferences() updates the default_preferences with the frozen preferences of the desired FirefoxProfile which is defined as:

def update_preferences(self):
    for key, value in FirefoxProfile.DEFAULT_PREFERENCES['frozen'].items():
        self.default_preferences[key] = value
    self._write_user_prefs(self.default_preferences)

However, you were close. You need to replace update_preference() with update_preferences() i.e. effectively in your code you need to replace:

profile.update_preference()

with

profile.update_preferences()

References

You can find a relevant discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352