1

I'm trying to run the following sample snippet

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Test
{
public static void main(String[] args)
{
     WebDriver driver = new FirefoxDriver();    
      driver.get("http://www.google.com");

    //System.out.println("My new program");

}
}

When I run this code, getting the following error.

Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:

e6fd}","syncGUID":"zxeywUS-QRBG","location":"app-global","version":"48.0","type":"theme","internalName":"classic/1.0","updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{"32":"icon.png","48":"icon.png"},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Default","description":"The default theme.","creator":"Mozilla","homepageURL":null,"contributors":["Mozilla Contributors"]},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1469556455000,"updateDate":1469556455000,"applyBackgroundUpdates":1,"skinnable":true,"size":21899,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"48.0","maxVersion":"48.0"}],"targetPlatforms":[],"seen":true}
1471332673510   addons.xpi  DEBUG   getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}

Firfox version is 48.0 Jar which added in eclipse is selenium-java-2.53.0, selenium-java-2.53.0-srcs.

Could anyone please help me to fix this issue.

Shridutt Kothari
  • 7,326
  • 3
  • 41
  • 61
testing
  • 1,736
  • 15
  • 46
  • 75
  • Have a look here http://stackoverflow.com/questions/38676719/fail-to-launch-mozilla-with-selenium/38676858#38676858 – Saurabh Gaur Aug 16 '16 at 07:50
  • Downgrade FF to 47. Or refer to this github issue for further details regarding FF48 and how to proceed - https://github.com/SeleniumHQ/selenium/issues/2559. – Grasshopper Aug 16 '16 at 07:52

2 Answers2

1

FireFox 48 brought in some changes that don't play nicely with webdriver. You will need to switch the firefox over to Marionette.

Instructions found here: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette

Wes Young
  • 76
  • 7
0

Wes Young is right. Firefox changed behavior starting version 48. You need to use selenium 3 with gecko driver provided by firefox.

Little explanation : Before Selenium 3, FirefoxDriver used to be in form of Firefox Extension which used to get installed when we instantite firefox driver. But starting with version 48, Firefox made a change how extensions behave in firefox, basically every extension has to be signed by firefox and driver extension did not qualify for that. So Firefox took the responsibility of developing the standalone driver for firefox like we have in chrome. Basically you will have to download gecko driver place it somewhere and configure the path in webdriver.gecko.driver system variable and then use it. It is almost identical to how we use chromedriver now.

PS : we can still use previous versions of firefox with selenium 3 using old firefox driver (in extension form). There is a property to tell we want to use legacy driver (old firefox driver in extension form) or new driver (gecko driver). This has to be set in capabilities.

caps["marionette"] = True/False in python

Similar in other languages

Satish Gupta
  • 1,447
  • 1
  • 12
  • 14
  • [How can we set legacy driver with preferences in Selenium 3 using python](http://stackoverflow.com/questions/40086011/how-to-set-a-specific-download-location-in-mozilla-marionette-web-driver) – Surabhil Sergy Oct 17 '16 at 16:21