python selenium 实现Firefox自定义加载profile

本文介绍如何使用Selenium实现Firefox自定义加载Profile的方法,解决默认Profile配置中插件及配置干扰问题,避免老Profile遗留导致浏览器无法启动的情况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

实现Firefox自定义加载profile, 主要解决以下问题:

  • 解决走默认profile配置有插件、各种配置干扰问题
  • 解决老profile遗留导致不能启动firefox问题
  • 注:selenium版本:2.53.17-py2.7

profile模板:
[General]
StartWithLastProfile=1

[Profile0]
Name=default
IsRelative=1 #如果设置 为0表示关闭相关设置
Path=Profiles/jz6mhrzv.default
Default=1


代码块

代码块语法遵循标准markdown代码,例如:

from selenium import webdriver

def load_firefox_browser():
    cus_profile_dir = "\yourpath" # 你自定义profile的路径
    cus_profile = wedriver.FirefoxProfile(cus_profile_dir)
    browser = webdriver.Firefox(cus_profile)
    borwser.implicitly_wait(30)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值