programing tip

Firefox 47에서 Selenium 2.53이 작동하지 않음

itbloger 2020. 8. 10. 07:47
반응형

Firefox 47에서 Selenium 2.53이 작동하지 않음


WebDriver와 함께 Firefox를 사용하는 동안 오류가 발생합니다.

org.openqa.selenium.firefox.NotConnectedException: Unable to connect
to host 127.0.0.1 on port 7055 after 45000 ms.
  • Firefox 버전 : 47.0
  • 셀레늄 : 2.53.0
  • Windows 10 64 비트

비슷한 문제가 있거나 이것에 대한 해결책이 무엇인지 아는 사람이 있습니까? Chrome에서는 잘 작동하지만 Firefox에서는 URL이로드되지 않습니다.


불행히도 Selenium WebDriver 2.53.0은 Firefox 47.0과 호환되지 않습니다. Firefox 브라우저 ( FirefoxDriver) 를 처리하는 WebDriver 구성 요소 는 중단됩니다. 버전 3.0부터 Selenium WebDriver는 geckodriverFirefox 브라우저를 관리하기 위해 바이너리 가 필요 합니다. 여기여기에 더 많은 정보가 있습니다 .

따라서 Firefox 47.0을 Selenium WebDriver 2.53.0과 함께 브라우저로 사용하려면 Firefox 드라이버 ( geckodriver이전 버전 0.8.0 의 바이너리 파일) 를 다운로드 wires하고 절대 경로를 다음 webdriver.gecko.driver과 같이 변수 보내야 합니다 . Java 코드의 시스템 속성 :

System.setProperty("webdriver.gecko.driver", "/path/to/geckodriver");

다행히 WebDriverManager 라이브러리 가이 작업을 수행 할 수 있습니다. 즉, 컴퓨터 (Linux, Mac 또는 Windows)에 적합한 Marionette 바이너리를 다운로드하고 적절한 시스템 속성 값을 내보낼 수 있습니다. 이 라이브러리를 사용하려면 프로젝트에이 종속성을 포함해야합니다.

<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>3.7.1</version>
</dependency>

... 그리고 WebDriver를 사용하기 전에 프로그램에서 다음 줄을 실행하십시오.

WebDriverManager.firefoxdriver().setup();

WebDriver를 사용하는 JUnit 4 테스트 케이스의 전체 실행 예제는 다음과 같습니다.

public class FirefoxTest {

    protected WebDriver driver;

    @BeforeClass
    public static void setupClass() {
        WebDriverManager.firefoxdriver().setup();
    }

    @Before
    public void setupTest() {
        driver = new FirefoxDriver();
    }

    @After
    public void teardown() {
        if (driver != null) {
            driver.quit();
        }
    }

    @Test
    public void test() {
        // Your test code here
    }
}

Marionette는 미래 (WebDriver 3+ 및 Firefox 48+의 경우)를위한 유일한 옵션이 될 것이지만 현재 (작성 시점에 버전 0.9.0)은 그다지 안정적이지 않습니다. 자세한 내용 Marionette 로드맵 을 참조하십시오.

최신 정보

Selenium WebDriver 2.53.1 은 2016 년 6 월 30 일에 출시되었습니다 . 브라우저 FirefoxDriver로 Firefox 47.0.1함께 다시 작동 합니다.


firefox 46.0.1을 사용해보십시오. Selenium 2.53과 가장 잘 어울립니다.

https://ftp.mozilla.org/pub/firefox/releases/46.0.1/win64/en-US/

I had the same issue and found out that you need to switch drivers because support was dropped. Instead of using the Firefox Driver, you need to use the Marionette Driver in order to run your tests. I am currently working through the setup myself and can post some suggested steps if you'd like when I have a working example.

Here are the steps I followed to get this working on my Java environment on Mac (worked for me in my Linux installations (Fedora, CentOS and Ubuntu) as well):

  1. Download the nightly executable from the releases page
  2. Unpack the archive
  3. Create a directory for Marionette (i.e., mkdir -p /opt/marionette)
  4. Move the unpacked executable file to the directory you made
  5. Update your $PATH to include the executable (also, edit your .bash_profile if you want)
  6. :bangbang: Make sure you chmod +x /opt/marionette/wires-x.x.x so that it is executable
  7. In your launch, make sure you use the following code below (it is what I used on Mac)

Quick Note

Still not working as expected, but at least gets the browser launched now. Need to figure out why - right now it looks like I need to rewrite my tests to get it to work.

Java Snippet

WebDriver browser = new MarionetteDriver();
System.setProperty("webdriver.gecko.driver", "/opt/marionette/wires-0.7.1-OSX");

If you're on OSX using Homebrew, you can install old Firefox versions via brew cask:

brew tap goldcaddy77/firefox
brew cask install firefox-46 # or whatever version you want

After installing, you'll just need to rename your FF executable in the Applications directory to "Firefox".

More info can be found at the git repo homebrew-firefox. Props to smclernon for creating the original cask.


If you're on a Mac do brew install geckodriver and off you go!


In case anyone is wondering how to use Marionette in C#.

FirefoxProfile profile = new FirefoxProfile(); // Your custom profile
var service = FirefoxDriverService.CreateDefaultService("DirectoryContainingTheDriver", "geckodriver.exe");
// Set the binary path if you want to launch the release version of Firefox.
service.FirefoxBinaryPath = @"C:\Program Files\Mozilla Firefox\firefox.exe";
var option = new FirefoxProfileOptions(profile) { IsMarionette = true };
var driver = new FirefoxDriver(
    service,
    option,
    TimeSpan.FromSeconds(30));

Overriding FirefoxOptions to provide the function to add additional capability and set Firefox profile because selenium v53 doesn't provide that function yet.

public class FirefoxProfileOptions : FirefoxOptions
{
    private DesiredCapabilities _capabilities;

    public FirefoxProfileOptions()
        : base()
    {
        _capabilities = DesiredCapabilities.Firefox();
        _capabilities.SetCapability("marionette", this.IsMarionette);
    }

    public FirefoxProfileOptions(FirefoxProfile profile)
        : this()
    {
        _capabilities.SetCapability(FirefoxDriver.ProfileCapabilityName, profile.ToBase64String());
    }

    public override void AddAdditionalCapability(string capabilityName, object capabilityValue)
    {
        _capabilities.SetCapability(capabilityName, capabilityValue);
    }

    public override ICapabilities ToCapabilities()
    {
        return _capabilities;
    }
}

Note: Launching with profile doesn't work with FF 47, it works with FF 50 Nightly.

However, we tried to convert our test to use Marionette, and it's just not viable at the moment because the implementation of the driver is either not completed or buggy. I'd suggest people downgrade their Firefox at this moment.


New Selenium libraries are now out, according to: https://github.com/SeleniumHQ/selenium/issues/2110

The download page http://www.seleniumhq.org/download/ seems not to be updated just yet, but by adding 1 to the minor version in the link, I could download the C# version: http://selenium-release.storage.googleapis.com/2.53/selenium-dotnet-2.53.1.zip

It works for me with Firefox 47.0.1.

As a side note, I was able build just the webdriver.xpi Firefox extension from the master branch in GitHub, by running ./go //javascript/firefox-driver:webdriver:run – which gave an error message but did build the build/javascript/firefox-driver/webdriver.xpi file, which I could rename (to avoid a name clash) and successfully load with the FirefoxProfile.AddExtension method. That was a reasonable workaround without having to rebuild the entire Selenium library.


Its a FF47 issue https://github.com/SeleniumHQ/selenium/issues/2110

Please downgrade to FF 46 or below (or try out FF48 developer https://developer.mozilla.org/en-US/Firefox/Releases/48)

Instructions on how to downgrade: https://www.liberiangeek.net/2012/04/how-to-install-previous-versions-of-firefox-in-ubuntu-12-04-precise-pangolin/ Or if you are on Mac, as suggested by someone else in this thread use brew.


Firefox 47.0 stopped working with Webdriver.

Easiest solution is to switch to Firefox 47.0.1 and Webdriver 2.53.1. This combination again works. In fact, restoring Webdriver compatibility was the main reason behind the 47.0.1 release, according to https://www.mozilla.org/en-US/firefox/47.0.1/releasenotes/.


You can try using this code,

private WebDriver driver;
System.setProperty("webdriver.firefox.marionette","Your path to driver/geckodriver.exe");        
driver = new FirefoxDriver();

I upgraded to selenium 3.0.0 and Firefox version is 49.0.1

You can download geckodriver.exe from https://github.com/mozilla/geckodriver/releases

Make sure you download zip file only, geckodriver-v0.11.1-win64.zip file or win32 one as per your system and extract it in a folder.

Put the path for that folder in the "Your path to driver" quotes.Don't forget to put geckodriver.exe in the path.


I eventually installed an additional old version of Firefox (used for testing only) to resolve this, besides my regular (secure, up to date) latest Firefox installation.

This requires webdriver to know where it can find the Firefox binary, which can be set through the webdriver.firefox.bin property.

What worked for me (mac, maven, /tmp/ff46 as installation folder) is:

mvn -Dwebdriver.firefox.bin=/tmp/ff46/Firefox.app/Contents/MacOS/firefox-bin verify

To install an old version of Firefox in a dedicated folder, create the folder, open Finder in that folder, download the Firefox dmg, and drag it to that Finder.


Here's what the problem looked like in Wireshark

Just load up 2.53.1 and every thing will work.


As of September 2016

Firefox 48.0 and selenium==2.53.6 work fine without any errors

To upgrade firefox on Ubuntu 14.04 only

sudo apt-get update
sudo apt-get upgrade firefox

It seems to me that the best solution is to update to Selenium 3.0.0, download geckodriver.exe and use Firefox 47 or higher.

I changed Firefox initialization to:

 string geckoPathTest = Path.Combine(Environment.CurrentDirectory, "TestFiles\\geckodriver.exe");
 string geckoPath = Path.Combine(Environment.CurrentDirectory, "geckodriver.exe");
 File.Copy(geckoPathTest, geckoPath);
 Environment.SetEnvironmentVariable("webdriver.gecko.driver", geckoPath);
 _firefoxDriver = new FirefoxDriver();

I can confirm that selenium 2.53.6 works with firefox 44 for me on ubuntu 15.

참고URL : https://stackoverflow.com/questions/37693106/selenium-2-53-not-working-on-firefox-47

반응형