Sourajyoti Bose
Sourajyoti Bose

Reputation: 83

Selenium 3.3.1 StandAlone Jar

I tried loading a page into Firefox 52 using the selenium-standalone-3.3.1.jar. However I got thrown this error :-

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host  127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
":["Mozilla Contributors"]},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1488491056000,"updateDate":1488491056000,"applyBackgroundUpdates":1,"skinnable":true,"size":19581,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"52.0","maxVersion":"52.0"}],"targetPlatforms":[],"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false}
1489475216110   addons.xpi  DEBUG   getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1489475216111   DeferredSave.extensions.json    DEBUG   Save changes
1489475216111   addons.xpi  DEBUG   Updating database with changes to installed add-ons
1489475216111   addons.xpi-utils    DEBUG   Updating add-on states
1489475216116   addons.xpi-utils    DEBUG   Writing add-ons list
1489475216122   addons.xpi  DEBUG   Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1489475216122   addons.xpi  DEBUG   Calling bootstrap method startup on [email protected] version 2.0
1489475216123   addons.xpi  DEBUG   Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1489475216124   addons.xpi  DEBUG   Calling bootstrap method startup on [email protected] version 1.9
1489475216124   addons.xpi  DEBUG   Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1489475216125   addons.xpi  DEBUG   Calling bootstrap method startup on [email protected] version 1.0.5 
1489475216125   addons.xpi  DEBUG   Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1489475216126   addons.xpi  DEBUG   Calling bootstrap method startup on [email protected] version 1.0
1489475216128   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1489475216128   addons.manager  DEBUG   Provider finished startup: XPIProvider
1489475216128   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1489475216128   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1489475216128   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager

....
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:129)
at com.obp.selenium.Framework.WebBrowserAction.launchBrowser(WebBrowserAction.java:124)

The function I have called is as follows to launch a Firefox WebBrowser:-

System.setProperty("webdriver.firefox.marionette",
                               aProperties.getProperties().getProperty(aProperties.getOsName() + ".BasePath")
                                                               + aProperties.getProperties().getProperty(aProperties.getOsName() + ".geckoDriverPath"));
            System.setProperty("webdriver.firefox.bin", aProperties.getProperties().getProperty(aProperties.getOsName() + ".FFbrowserPath"));
            System.setProperty("webdriver.firefox.port", String.valueOf(portNumber));
            DesiredCapabilities cap = DesiredCapabilities.firefox();
            cap.setCapability("applicationCacheEnabled", true);
            driver = new FirefoxDriver(cap);

Upvotes: 1

Views: 2618

Answers (1)

Moshisho
Moshisho

Reputation: 2981

The selenium-standalone jar is used to run tests in a grid, meaning RemoteWebDriver. You're trying to run WebDriver locally.

So you need to first understand what do you need?

  • If you want to run locally, you can use the same code you're using now and you don't need the standalone jar.
  • If you need to run on a remote machine the you need to use the jar to setup a server and a node with Firefox and change your code to run with RemoteWebDriver. Something like:

driver = new RemoteWebDriver(new URL("http://HUB_URL:4444/wd/hub"), capabilities);

Upvotes: 1

Related Questions