无法在python硒中加载firefox插件 [英] Unable to load firefox Add ons in python selenium

查看:127
本文介绍了无法在python硒中加载firefox插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在运行硒Webdriver时加载Zenmate Firefox插件 当我不加载任何插件(扩展)而运行但在添加插件时出现问题时,它运行良好. 这是我的代码:

I want to Load Zenmate Firefox Addons when selenium webdriver runs it runs fine when i run without loading any addons ( extensions ) but having problem while adding any addons . Here is my Code :

def __init__(self):   

        self.main_catag_driver = []
        self.declare_xpaths()
        self.main_web_url = "Some_website_url"
        self.path_fire_fox_file = "~/.mozilla/firefox/7rl1aw4c.default/extensions/firefox@zenmate.com.xpi"
        self.driver = webdriver.Firefox()
        self.driver.add_extension(extension=self.path_fire_fox_file)
        time.sleep(5)
        self.driver.get(self.main_web_url)

加载Bar时出错:

Traceback (most recent call last):
  File "scrap.py", line 73, in <module>
    obj = carandclassic()
  File "scrap.py", line 28, in __init__
    self.driver.add_extension(extension=self.path_fire_fox_file)
AttributeError: 'WebDriver' object has no attribute 'add_extension'

推荐答案

此外,我不确定您是否真的需要拨打time.sleep(5)电话-尝试不浪费5秒.

Plus, I'm not sure if you really need that time.sleep(5) call - try without wasting 5 seconds.

这篇关于无法在python硒中加载firefox插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆