nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.79k stars 1.31k forks source link

Firefox webdriver needs to be replaced by Marionette from Firefox version 47.0 #1025

Closed mariusioana closed 5 years ago

mariusioana commented 8 years ago

Hi,

With recent version of Firefox 47.0, selenium server latest version 2.53 does not work anymore: http://stackoverflow.com/questions/37693106/selenium-2-53-not-working-on-firefox-47 https://github.com/SeleniumHQ/selenium/issues/2110

So now it is recommended to just make use of Marionette to replace Firefox webdriver: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver

Any recommendations on how to make it work now with nightwatchjs?

Thanks!

redrockzee commented 8 years ago

Firefox does not work. Neither does IEDriverServer.exe, The only driver that works anymore is Chrome.

martineez commented 8 years ago

you have to download geckodriver (there's no nodejs wrapper)

  selenium: {
    cli_args: {
      'webdriver.gecko.driver': '/path/to/geckodriver'
    }
  },
  ...
  test_settings: {
    default: {
      desiredCapabilities: {
        browserName: 'firefox',
        marionette: true,
        javascriptEnabled: true
      }
}
dealloc commented 8 years ago

@martineez your suggestion got it working here for me, though the documentation should be updated (new users don't like having to skim issues for things like these)

beatfactor commented 8 years ago

I'll add this to the docs soon.

mariusioana commented 8 years ago

Thanks @martineez ! It worked. Though the problem now for is that with this new driver, following code seems to not work anymore. browser.api.execute seems that it does not work anymore to get the _initialState_ property from window object. This is a regression. Tried on Chrome the same and works nicely. Also, on older versions of FF works ok. So maybe this is a bug now? @beatfactor , any ideas? It kind of blocks me from running the tests and would really appreciate some help or guidance :). Thanks!

getSession: function(browser) {
    return new Promise(function(session) {
      browser.api.execute(function() {
        return {
          catalogUrl: window._initialState_.catalogUrl,
          accessToken: (JSON.parse(window.localStorage.getItem(window._initialState_.macConfig.clientId))).accessToken
        }
      }, [], function(result) {
        session(result.value);
      })
    });
  },

Error seen in session when used in debugging mode:

TypeError: window._initialState_ is undefined (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 8 milliseconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'ioana-osx.eur.adobe.com', ip: '10.131.168.79', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.3', java.version: '1.8.0_74'
Driver info: org.openqa.selenium.firefox.MarionetteDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, marionette=true, appBuildId=20160604131506, version=47.0, platform=MAC, proxy={}, command_id=1, specificationLevel=0, acceptSslCerts=false, browserVersion=47.0, platformVersion=14.3.0, name=Cleanup Connections, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=Firefox, takesScreenshot=true, javascriptEnabled=true, takesElementScreenshot=true, platformName=Darwin, device=desktop}]
Session ID: 90f93a94-e5dd-8b41-b8ce-ffacae5a4d9e
beatfactor commented 8 years ago

Maybe this will help: https://bugzilla.mozilla.org/show_bug.cgi?id=825858?

mariusioana commented 8 years ago

Excellent, it worked! Thanks @beatfactor !

aeneasr commented 8 years ago

i tried @martineez hints but my firefox (47.0.1) just opens about:blank&utm_content=firstrun and returns

Error retrieving a new session from the selenium server

Connection refused! Is selenium server started?
{ state: 'unhandled error',
  sessionId: null,
  hCode: 1075377371,
  value: 
   { localizedMessage: 'Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox conso
le

nightwatch.json

{
  "src_folders" : ["tests"],
  "output_folder" : "reports",
  "custom_commands_path" : "",
  "custom_assertions_path" : "",
  "page_objects_path" : "",
  "globals_path" : "",

  "selenium" : {
    "start_process" : true,
    "server_path" : "./bin/selenium-server-standalone-2.53.0.jar",
    "log_path" : "",
    "host" : "127.0.0.1",
    "port" : 4444,
    "cli_args" : {
      "webdriver.chrome.driver" : "",
      "webdriver.ie.driver" : "",
      "webdriver.gecko.driver": "C:\\ChromeDriver\\geckodriver.exe"
    }
  },

  "test_settings" : {
    "default" : {
      "launch_url" : "http://localhost:3000",
      "selenium_port"  : 4444,
      "selenium_host"  : "localhost",
      "silent": true,
      "screenshots" : {
        "enabled" : false,
        "path" : ""
      },
      "desiredCapabilities": {
        "browserName": "firefox",
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
    },

    "chrome" : {
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
    }
  }
}
CleanCodeWillKeepYouAlive commented 8 years ago

same prob as @arekkas has, pass step with dowload gecko driver and specified path in configure file but error still displayed: Error retrieving a new session from the selenium server Connection refused! Is selenium server started?

straris commented 8 years ago

Same here :(

ghost commented 8 years ago

@arekkas You missed the marionette: true, from martineez's config example

beatfactor commented 8 years ago

This should be closed and moved to the wiki (until we have a section on the website) Is someone who has got it working able to summarize this and create a wiki article? Thanks.

aeneasr commented 8 years ago

@DanC-UNiDAYS indeed, thank you!

aeneasr commented 8 years ago

The config I got it working with is:

{
  "src_folders" : ["tests"],
  "output_folder" : "reports",
  "custom_commands_path" : "",
  "custom_assertions_path" : "",
  "page_objects_path" : "",
  "globals_path" : "",

  "selenium" : {
    "start_process" : true,
    "server_path" : "./bin/selenium-server-standalone-2.53.0.jar",
    "log_path" : "",
    "host" : "127.0.0.1",
    "port" : 4444,
    "cli_args" : {
      "webdriver.chrome.driver" : "",
      "webdriver.ie.driver" : "",
      "webdriver.gecko.driver": "C:\\ChromeDriver\\geckodriver.exe"
    }
  },

  "test_settings" : {
    "default" : {
      "launch_url" : "http://localhost:3000",
      "selenium_port"  : 4444,
      "selenium_host"  : "localhost",
      "silent": true,
      "screenshots" : {
        "enabled" : false,
        "path" : ""
      },
      "desiredCapabilities": {
        "browserName": "firefox",
        "javascriptEnabled": true,
        "acceptSslCerts": true,
        "marionette": true
      }
    },

    "chrome" : {
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
    }
  }
}
IceCreamYou commented 8 years ago

FWIW, I was able to get this working with geckodriver 0.9.0 and Selenium 2.53.1 as described above. I was not able to get it working with geckodriver 0.10.0 + Selenium 3.0.0-beta2 or with geckodriver 0.10.0 + Selenium 2.53.1.

Update: Seems to work with geckodriver/Marionette 0.11.1 and Selenium 2.53.1, although I haven't been able to get mouseButtonClick() to work in any version of geckodriver. click() does seem to work.

traviskaufman commented 8 years ago

Same here: Not able to get it working without redundantly downloading a lesser version of the geckodriver :(

naissa12 commented 8 years ago

I get the following errors when I run geckodriver with selenium 2.53

(firefox:25304): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed
JavaScript warning: https://normandy.cdn.mozilla.net/static/bundles/selfrepair-5c0beb002c2cc297accf.57474d2dada3.js, line 7: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create

Does anyone get this error?

naissa12 commented 8 years ago

@arekkas what version of firefox are you using?

naissa12 commented 8 years ago

which one is that?

aeneasr commented 8 years ago

48.0.2

Am 10.09.2016 um 00:01 schrieb naissa12 notifications@github.com:

which one is that?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nightwatchjs/nightwatch/issues/1025#issuecomment-246052772, or mute the thread https://github.com/notifications/unsubscribe-auth/ADN1eo_pJ-VlXEk-2fVds4kC8uDWCLWsks5qodcngaJpZM4I2Gca.

naissa12 commented 8 years ago

@arekkas what OS?

vangorra commented 8 years ago

FYI. Looks like a geckdriver is now availble through npm.

https://www.npmjs.com/package/geckodriver

potapovDim commented 7 years ago

@naissa12

{
  "src_folders": [
    "tests"
  ],
  "output_folder": "reports",
  "custom_commands_path": "commands",
  "custom_assertions_path": "",
  "page_objects_path": [
    "pages/account",
    "pages"
  ],
  "globals_path": "globals.js",
  "selenium": {
    "start_process": true,
    "server_path": "./node_modules/webdriver-manager/selenium/selenium-server-standalone-2.53.1.jar",
    "log_path": "",
    "host": "127.0.0.1",
    "port": 4444,
    "cli_args": {
      "webdriver.chrome.driver": "./node_modules/webdriver-manager/selenium/chromedriver_2.25",
      "webdriver.gecko.driver": "./node_modules/geckodriver/geckodriver",
      "webdriver.opera.driver": "./node_modules/operadriver/lib/operadriver.js"
    }
  },
  "test_settings": {
    "default": {
      "launch_url": "http://localhost",
      "selenium_port": 4444,
      "selenium_host": "localhost",
      "silent": true,
      "screenshots": {
        "enabled": false,
        "path": ""
      },
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
    },
    "phantom": {
      "desiredCapabilities": {
        "browserName": "phantomjs",
        "javascriptEnabled": true,
        "acceptSslCerts": true,
        "phantomjs.binary.path": "./node_modules/phantomjs/bin/phantomjs",
        "phantomjs.cli.args": [
          "--ignore-ssl-errors=true"
        ]
      }
    },
    "safari": {
      "desiredCapabilities": {
        "browserName": "safari",
        "version": "49",
        "api_key": "api_key",
        "api_secret": "api_secret"
      }
    },
    "firefox":{
      "desiredCapabilities": {
        "browserName": "firefox",
        "javascriptEnabled": true,
        "acceptSslCerts": true,
        "marionette": true
      }
    }
  }
}
dayanamcc commented 7 years ago

how can addapt the same but into wdio.conf.js but instead of using nitghwatch using WebdriverIO webdriverIO + selenium-server v2.53.1 and ghekodriver ???

i want something like this selenium: { cli_args: { 'webdriver.gecko.driver': './---path-to geckodriver--/0.13.0-x64-geckodriver'?? } },

but into webdriverIO

this is how is working now on IE and on Chrome services: ['selenium-standalone']

   seleniumArgs: {
      version: '2.53.1',
      drivers: {
      ie: {
          version: '2.53.1',
          arch: 'ia32',
          baseURL: 'https://selenium-release.storage.googleapis.com',
      },
      chrome: {
          version: '2.27',
          arch: process.arch,
          baseURL: 'https://chromedriver.storage.googleapis.com'
      },
      firefox:{
               should i set something here ¿? or? 
      }
    }
  },
straris commented 7 years ago

@dayanamcc shouldn't you be asking that on webdriverIO instead?

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had any recent activity. If possible, please retry using the latest Nightwatch version and update the issue with any relevant details. If no further activity occurs, it will be closed. Thank you for your contribution.