ssharma
ssharma

Reputation: 941

I'm not able to run protractor test in firefox but in chrome it runs fine

When I am trying to run Protractor e2e test in firefox, it launches the browser but my test scripts do not get executed.

I am using windows Server 2012 R2 machine with firefox version 46.0.1 and Selenium 2.53.0.

It gives me the following error:

Using FirefoxDriver directly...
[launcher] Running 1 instances of WebDriver

code\ui\dgui\node_modules\protractor\node_modules\selenium-webdriver\http\util.js:89
          Error('Timed out waiting for the WebDriver server at ' + url));
          ^
Error: Timed out waiting for the WebDriver server at http://127.0.0.1:58798/hub

I tried running Selenium standalone

    code\ui\dgui\node_modules\protractor\selenium>java -jar selenium-server-standalone-2.53.0.jar
    09:37:21.214 INFO - Launching a standalone Selenium Server
    09:37:21.285 INFO - Java: Oracle Corporation 25.91-b14
    09:37:21.285 INFO - OS: Windows Server 2012 R2 6.3 amd64
    09:37:21.293 INFO - v2.53.0, with Core v2.53.0. Built from revision 35ae25b
    09:37:21.332 INFO - Driver class not found: com.opera.core.systems.OperaDriver
    09:37:21.332 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
    09:37:21.336 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
    registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN8
    09:37:21.336 INFO - Driver class not found: org.openqa.selenium.htmlunit.HtmlUnitDriver
    09:37:21.336 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered
09:37:21.434 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
09:37:21.434 INFO - Selenium Server is up and running

I am using npm run e2e command to execute my test

my Config file:

exports.config = {

  allScriptsTimeout: 30000,

  suites: {
      test Suit: 'e2e/TestSuites/Tests/*.js',
  },

   multiCapabilities: [

    // We will want to eventually include the following options to split out tests to multiple instances

    {'browserName': 'firefox'}
  ],


  // only for firefox and chrome - IE will require using a selenium server

  directConnect : true,  

  // make sure that the baseURL reflects the configuration of the web server

  baseUrl: 'http://10.26.5.13:8000/',


  framework: 'jasmine2',

  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
  },


  onPrepare: function() {     
    var jasmineReporters = require('jasmine-reporters');

    browser.driver.manage().window().maximize();

    return browser.getProcessedConfig().then(function(config) {

      var browserName = config.capabilities.browserName;


      var junitReporter = new jasmineReporters.JUnitXmlReporter({
             consolidateAll: true,
             savePath: 'tests/test-results',
             // this will produce distinct xml files for each capability
             filePrefix: browserName + '-xmloutput',
             modifySuiteName: function(generatedSuiteName, suite) {
                 // this will produce distinct suite names for each capability,
                 // e.g. 'firefox.login tests' and 'chrome.login tests'
                 return browserName + '.' + generatedSuiteName;
             }

         });
         jasmine.getEnv().addReporter(junitReporter);
    });    

  }, 

  resultJsonOutputFile: 'tests/test-results/output.json'

};

Upvotes: 3

Views: 14373

Answers (4)

PDHide
PDHide

Reputation: 19989

Add the binary (firefox.exe) location as moz:firefoxOptions capability

exports.config = {   

   capabilities: {
        browserName: 'firefox',
        shardTestFiles: false,
        'moz:firefoxOptions': {
    'binary': "<your_path>/Mozilla Firefox/firefox.exe"
  }
    },

Upvotes: 1

k_rollo
k_rollo

Reputation: 5472

Follow Protractor setup here: http://www.protractortest.org/#/tutorial#setup

These versions are what worked for me:

Node: v6.9.4
NPM: v3.10.10
Protractor: v5.1.0
Selenium WebDriver: 3.0.1
Firefox: 51.0.1

conf.js:

exports.config = {
  framework: 'jasmine',
  // no need for seleniumAddress for firefox and chrome
  specs: ['spec.js'],
  capabilities: {
    browserName: 'firefox',
    firefoxPath: 'C:/Program Files/Mozilla Firefox/firefox.exe'
  },
  directConnect: true // for firefox and chrome
}

https://github.com/angular/protractor/blob/master/lib/config.ts

Upvotes: 1

Pixki
Pixki

Reputation: 51

Had the same problem with firefox version 49.0.2 and Selenium 2.52.0 I installed Firefox portable 46 and everything worked for me.

And in my protractor.config-file i set:

...
    capabilities: {
    // FIREFOX portable in version 46.0.1
    'browserName': 'firefox',
    "firefox_binary": "C:/DEV/FirefoxPortable64-46.0.1/FirefoxPortable64/FirefoxPortable.exe",
    "binary_": "C:/DEV/FirefoxPortable64-46.0.1/FirefoxPortable64/FirefoxPortable.exe"
},
// tells protractor to directly connect to the webdriver
directConnect: true
...

I downloaded Firefox Portable here: http://www.m64.info/index.php/firefox-64-bit-portable That's also a good opportunity to have more than one version of firefox "installed" :-) Hope somebody will help it!

Upvotes: 1

ssharma
ssharma

Reputation: 941

Found this link: https://github.com/angular/protractor/issues/3182,

I was also facing similar issue.

I tried installing Firefox v44.0.2 and then executed my scripts, it worked.

I was using Firefox v46 earlier, and my scripts were not executing with Firefox v46.

Upvotes: 2

Related Questions