Protractor with Firefox using marionette driver

There have been various issues using selenium-standalone driver due to frequent update to Firefox.  It’s great to see marionette driver from Mozilla. It’s well documented at https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette  .

In this article, I have covered steps required to use it with protractor. Note that “Protractor” does not yet support Selenium-Standalone 3.x. Additionally, gecko version 0.8 is the max version that works with selenium-standalone jar 2.x

Steps:

  1. Download gecko driver from https://github.com/mozilla/geckodriver/releases/tag/v0.8.0
  2. Instead of using  webdriver-manager start, use below command
    java -jar /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-2.53.1.jar -Dwebdriver.chrome.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.22 -Dwebdriver.gecko.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-0.8.0-OSX

3.  Add below lines in protractor.conf

capabilities: {
    'browserName': 'firefox',
    'marionette': true
  },

 

That’s it.  You are ready to use Marionette

 

 

–> Above solution solves most of the issue with Firefox 47.x 48.x / selenium-server-standalone-2.53.1.jar

–> It solves issues ike:

1- Firefox launches , but does not load the url

2. You get below exception

[22:41:07] E/launcher - Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
-a285-3208198ce6fd}","syncGUID":"qek8BxoYPz7q","location":"app-global","version":"48.0.2","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":"/Applications/Firefox.app/Contents/Resources/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1473992361000,"updateDate":1473992361000,"applyBackgroundUpdates":1,"skinnable":true,"size":7140,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"48.0.2","maxVersion":"48.0.2"}],"targetPlatforms":[],"seen":true}
1474090822432    addons.xpi    DEBUG    getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1474090822433    DeferredSave.extensions.json    DEBUG    Save changes
1474090822433    addons.xpi    DEBUG    Updating database with changes to installed add-ons
1474090822433    addons.xpi-utils    DEBUG    Updating add-on states
1474090822433    addons.xpi-utils    DEBUG    Writing add-ons list
1474090822434    addons.xpi    DEBUG    Registering manifest for /Applications/Firefox.app/Contents/Resources/browser/features/e10srollout@mozilla.org.xpi
1474090822434    addons.xpi    DEBUG    Calling bootstrap method startup on e10srollout@mozilla.org version 1.1
1474090822434    addons.xpi    DEBUG    Registering manifest for /Applications/Firefox.app/Contents/Resources/browser/features/firefox@getpocket.com.xpi
1474090822435    addons.xpi    DEBUG    Calling bootstrap method startup on firefox@getpocket.com version 1.0.4
1474090822435    addons.xpi    DEBUG    Registering manifest for /Applications/Firefox.app/Contents/Resources/browser/features/loop@mozilla.org.xpi
1474090822436    addons.xpi    DEBUG    Calling bootstrap method startup on loop@mozilla.org version 1.4.4
1474090822451    addons.manager    DEBUG    Registering shutdown blocker for XPIProvider
1474090822451    addons.manager    DEBUG    Provider finished startup: XPIProvider
1474090822451    addons.manager    DEBUG    Starting provider: LightweightThemeManager
1474090822451    addons.manager    DEBUG    Registering shutdown blocker for LightweightThemeManager
1474090822452    addons.manager    DEBUG    Provider finished startup: LightweightThemeManager
1474090822452    addons.manager    DEBUG    Starting provider: GMPProvider
1474090822456    addons.manager    DEBUG    Registering shutdown blocker for GMPProvider
1474090822456    addons.manager    DEBUG    Provider finished startup: GMPProvider
1474090822456    addons.manager    DEBUG    Starting provider: PluginProvider
1474090822457    addons.manager    DEBUG    Registering shutdown blocker for PluginProvider
1474090822457    addons.manager    DEBUG    Provider finished startup: PluginProvider
1474090822457    addons.manager    DEBUG    Completed startup sequence
1474090822865    addons.manager    DEBUG    Starting provider: <unnamed-provider>
1474090822865    addons.manager    DEBUG    Registering shutdown blocker for <unnamed-provider>
1474090822865    addons.manager    DEBUG    Provider finished startup: <unnamed-provider>
1474090822867    DeferredSave.extensions.json    DEBUG    Starting write
1474090823067    addons.repository    DEBUG    No addons.json found.
1474090823068    DeferredSave.addons.json    DEBUG    Save changes
1474090823070    DeferredSave.addons.json    DEBUG    Starting timer
1474090823115    addons.manager    DEBUG    Starting provider: PreviousExperimentProvider
1474090823116    addons.manager    DEBUG    Registering shutdown blocker for PreviousExperimentProvider
1474090823116    addons.manager    DEBUG    Provider finished startup: PreviousExperimentProvider
1474090823119    DeferredSave.extensions.json    DEBUG    Write succeeded
1474090823120    addons.xpi-utils    DEBUG    XPI Database saved, setting schema version preference to 17
1474090823125    DeferredSave.addons.json    DEBUG    Starting write
1474090823150    DeferredSave.addons.json    DEBUG    Write succeeded

[22:41:07] E/launcher - WebDriverError: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
-a285-3208198ce6fd}","syncGUID":"qek8BxoYPz7q","location":"app-global","version":"48.0.2","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":"/Applications/Firefox.app/Contents/Resources/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1473992361000,"updateDate":1473992361000,"applyBackgroundUpdates":1,"skinnable":true,"size":7140,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"48.0.2","maxVersion":"48.0.2"}],"targetPlatforms":[],"seen":true}
1474090822432    addons.xpi    DEBUG    getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1474090822433    DeferredSave.extensions.json    DEBUG    Save changes
1474090822433    addons.xpi    DEBUG    Updating database with changes to installed add-ons
1474090822433    addons.xpi-utils    DEBUG    Updating add-on states
1474090822433    addons.xpi-utils    DEBUG    Writing add-ons list
1474090822434    addons.xpi    DEBUG    Registering manifest for /Applications/Firefox.app/Contents/Resources/browser/features/e10srollout@mozilla.org.xpi
1474090822434    addons.xpi    DEBUG    Calling bootstrap method startup on e10srollout@mozilla.org version 1.1
1474090822434    addons.xpi    DEBUG    Registering manifest for /Applications/Firefox.app/Contents/Resources/browser/features/firefox@getpocket.com.xpi
1474090822435    addons.xpi    DEBUG    Calling bootstrap method startup on firefox@getpocket.com version 1.0.4
1474090822435    addons.xpi    DEBUG    Registering manifest for /Applications/Firefox.app/Contents/Resources/browser/features/loop@mozilla.org.xpi
1474090822436    addons.xpi    DEBUG    Calling bootstrap method startup on loop@mozilla.org version 1.4.4
1474090822451    addons.manager    DEBUG    Registering shutdown blocker for XPIProvider
1474090822451    addons.manager    DEBUG    Provider finished startup: XPIProvider
1474090822451    addons.manager    DEBUG    Starting provider: LightweightThemeManager
1474090822451    addons.manager    DEBUG    Registering shutdown blocker for LightweightThemeManager
1474090822452    addons.manager    DEBUG    Provider finished startup: LightweightThemeManager
1474090822452    addons.manager    DEBUG    Starting provider: GMPProvider
1474090822456    addons.manager    DEBUG    Registering shutdown blocker for GMPProvider
1474090822456    addons.manager    DEBUG    Provider finished startup: GMPProvider
1474090822456    addons.manager    DEBUG    Starting provider: PluginProvider
1474090822457    addons.manager    DEBUG    Registering shutdown blocker for PluginProvider
1474090822457    addons.manager    DEBUG    Provider finished startup: PluginProvider
1474090822457    addons.manager    DEBUG    Completed startup sequence
1474090822865    addons.manager    DEBUG    Starting provider: <unnamed-provider>
1474090822865    addons.manager    DEBUG    Registering shutdown blocker for <unnamed-provider>
1474090822865    addons.manager    DEBUG    Provider finished startup: <unnamed-provider>
1474090822867    DeferredSave.extensions.json    DEBUG    Starting write
1474090823067    addons.repository    DEBUG    No addons.json found.
1474090823068    DeferredSave.addons.json    DEBUG    Save changes
1474090823070    DeferredSave.addons.json    DEBUG    Starting timer
1474090823115    addons.manager    DEBUG    Starting provider: PreviousExperimentProvider
1474090823116    addons.manager    DEBUG    Registering shutdown blocker for PreviousExperimentProvider
1474090823116    addons.manager    DEBUG    Provider finished startup: PreviousExperimentProvider
1474090823119    DeferredSave.extensions.json    DEBUG    Write succeeded
1474090823120    addons.xpi-utils    DEBUG    XPI Database saved, setting schema version preference to 17
1474090823125    DeferredSave.addons.json    DEBUG    Starting write
1474090823150    DeferredSave.addons.json    DEBUG    Write succeeded

    at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:10)
    at Object.checkLegacyResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:639:15)
    at parseHttpResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:538:13)
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:472:11
    at ManagedPromise.invokeCallback_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14)
    at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)
    at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2820:25
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7
    at process._tickCallback (node.js:368:9)
From: Task: WebDriver.createSession()
    at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
    at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:458:24)
    at Hosted.DriverProvider.getNewDriver (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:37:33)
    at Runner.createBrowser (/usr/local/lib/node_modules/protractor/built/runner.js:190:43)
    at /usr/local/lib/node_modules/protractor/built/runner.js:264:30
    at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:796:13)
    at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:556:49
    at runSingle (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:137:13)
[22:41:07] E/launcher - Process exited with error code 199

 

 

Advertisements