Can't open browser with Selenium after Firefox update

后端 未结 7 1930
广开言路
广开言路 2020-11-22 10:54

I use Selenium WebDriver on Ubuntu Desktop 16.04, and I can\'t open browser. I get the following error after Firefox update (before this, it all worked):

Tra         


        
相关标签:
7条回答
  • 2020-11-22 11:04

    FIXED: Solution at this time is to downgrade Firefox! run this command to get a list of available Firefox versions.

    apt-cache show firefox | grep Version
    

    My Result:

    Version: 47.0+build3-0ubuntu0.16.04.1
    Version: 45.0.2+build1-0ubuntu1
    

    Install:

    sudo apt-get install firefox=45.0.2+build1-0ubuntu1
    

    To keep this version and disallow updates:

    sudo apt-mark hold firefox
    

    If you want to unhold firefox version and allow updates:

    sudo apt-mark unhold firefox
    sudo apt-get upgrade
    
    0 讨论(0)
  • 2020-11-22 11:12

    1) Download geckodriver 0.6.2, unzip, rename to "wires" not "wires.exe" https://github.com/mozilla/geckodriver/releases

    2) Add the wires executable location to PATH (I put this in my python folder C:Program Files\Python...) Select Start, select Control Panel. double click System, and select the Advanced tab. Click Environment Variables. ... In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. ... (Use ';' to separate paths i.e. [C:Users\Reuben;C:Program Files\Python]

    3) Downgrade to Firefox 45 https://ftp.mozilla.org/pub/firefox/releases/45.0.2/win64/en-US/

    0 讨论(0)
  • 2020-11-22 11:13

    No need to downgrade Firefox. I have faced issue with Windows and Firefox 49 version. I was using geckodrvier 64 bit version. I changed it to geckodrvier 32 bit version and it solved the issue. Now browser is opening properly without any issue.

    0 讨论(0)
  • 2020-11-22 11:18

    SOLUTION downgrade to 45 version:

    firefox --version
        Mozilla Firefox 47.0
    apt-get remove firefox
    wget https://ftp.mozilla.org/pub/firefox/releases/45.0/linux-x86_64/en-US/firefox-45.0.tar.bz2
    tar -xjf firefox-45.0.tar.bz2
    mv firefox /opt/firefox45
    ln -s /opt/firefox45/firefox /usr/bin/firefox
    firefox --version
        Mozilla Firefox 45.0
    
    0 讨论(0)
  • 2020-11-22 11:19

    Solution : Upgrade Firefox to 47.0.1 and Selenium to 2.53.1.

    This combination worked for me.

    For more details refer to https://stackoverflow.com/a/37728659/6469532

    0 讨论(0)
  • 2020-11-22 11:21

    As of Firefox version 47.0 (which came out a little while a go), a new driver must be used (created by mozilla instead of selenium) to connect to Firefox, because of a bug introduces in this version. As of Firefox version 48.0 the old driver will be deprecated completely and only Marionette can be used so it is better to switch now. See: Marionette Webdriver for Firefox

    Download the driver (in OSX just use brew install geckodriver), rename the executable to wires.exe on windows, or wires on *nix systems, and make sure the executable is present in your system path, then use this driver in your program instead of the old driver by using the following:

    When using a local webdriver:

    Python:

    firefox_capabilities = DesiredCapabilities.FIREFOX
    firefox_capabilities['marionette'] = True
    
    driver = webdriver.Firefox(capabilities=firefox_capabilities)
    

    Ruby:

    driver = Selenium::WebDriver.for :firefox, marionette: true
    

    Javascript:

    var capabilities = Capabilities.firefox();
    capabilities.set('marionette', true);
    
    var driver = new webdriver.Builder().withCapabilities(capabilities).build();
    

    Java:

    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    capabilities.setCapability("marionette", true);
    Webdriver driver = new FirefoxDriver(capabilities);
    

    C#:

    var driver = new FirefoxDriver(new FirefoxOptions());
    

    When using selenium grid:

    When using a selenium grid the driver should be present in the path for all machines in your grid.

    Python:

    firefox_capabilities = DesiredCapabilities.FIREFOX
    firefox_capabilities['marionette'] = True
    driver = webdriver.Firefox(capabilities=firefox_capabilities)
    

    Ruby:

    caps = Selenium::WebDriver::Remote::Capabilities.firefox marionette: true
    driver = Selenium::WebDriver.for :firefox, desired_capabilities: caps
    

    Java:

    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    // Set Marionette on so the Grid will use this instead of normal FirefoxDriver
    capabilities.setCapability("marionette", true);
    
    WebDriver driver = new RemoteWebDriver(capabilities); 
    

    C#:

    DesiredCapabilities capabilities = DesiredCapabilities.Firefox();
    // Set Marionette on so the Grid will use this instead of normal FirefoxDriver
    capabilities.SetCapability("marionette", true);
    
    var driver = new RemoteWebDriver(capabilities); 
    
    0 讨论(0)
提交回复
热议问题