python - AttributeError: 'FirefoxProfile' 对象没有属性 'update' 错误使用 FirefoxProfile 通过 Selenium 和 Python
问题描述
大家好,我的代码有问题。
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()
这是我得到的错误:
AttributeError: 'FirefoxProfile' object has no attribute 'update'
我无法弄清楚我只想保存配置文件设置以供使用的问题。
解决方案
我认为你需要改变这个
profile.update_preference()
有了这个:
profile.update_preferences()
推荐阅读
- python - PostgreSQL Sqlalchemy 提交需要很多时间
- javascript - 平移时如何在threejs中平移对象的质心
- ios - 如何在 swift 中使用字符串发出 HTTPPost 请求
- ios - 具有用于比较日期的瞬态属性的 FetchedResultsController
- javascript - zIndex 在组件中不起作用
- javascript-automation - 如何使用 JXA 制作新文档?
- talend - 运行时出现 Talend BigData 错误
- javascript - Javascript - 完整的字符串不显示在谷歌浏览器控制台中,只显示到第一个逗号
- c# - Visual Studio 2017 中的 Xamrain 表单构建任务参考错误
- rust - 如何仅将板条箱用于给定平台?