代码之家  ›  专栏  ›  技术社区  ›  jbelenus

使用Selenium和XUL的Firefox Quantum中的驱动程序错误

  •  0
  • jbelenus  · 技术社区  · 7 年前

    版本:

    • Ubuntu 16.04
    • Mozilla Firefox 58.0
    • 硒-3.7.0

    示例代码:

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    from selenium import webdriver
    
    profile = webdriver.FirefoxProfile()
    profile.set_preference("browser.privatebrowsing.autostart", True)
    driver = webdriver.Firefox(profile)
    

    使用Python Selenium的Firefox中出错:

    XML read error: entity not defined
    Location: chrome://browser/content/browser.xul
    Line number 1165, column 7:
          <menuitem class="pageActionContextMenuItem extensionUnpinned"
    ------^
    

    注: 如果在Ubuntu 12中使用FIrefox Quantum,也会出现此错误。

    1 回复  |  直到 7 年前
        1
  •  0
  •   jbelenus    7 年前

    说明: Is selenium IDE an XUL add-on in Firefox?

    解决方案,使用Firefox的旧版本:

    sudo apt-get remove --purge firefox
    sudo add-apt-repository ppa:ubuntu-mozilla-daily/firefox-aurora
    sudo apt-get update
    sudo apt-get install firefox=57.0+build4-0ubuntu0.16.04.5
    

    感谢@DebanjanB