0
votes
//Config.js 

*when ever i try execute this script on mozilla firefox getting the below error message.

var relativePath = __dirname + '/e2e/';
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
multiCapabilities: [
    {
        browserName: 'chrome'
shardTestFiles: true,
        maxInstances: 1,
        chromeOptions: {
            args: [
                '--disable-infobars',
                '--disable-extensions',
                'verbose',
                'log-path=./reports/chromedriver.log'
            ],
            prefs: {
                'profile.password_manager_enabled': false,
                'credentials_enable_service': false,
                'password_manager_enabled': false
            }
        }
    },
{
        browserName: 'firefox',
        marionette: 'true',
 },
framework: 'jasmine2',

  suites: {
    em2_login: ['e2e/tests/login/login.spec.js'],
},
params: {
    siteUrl: ''
},
onPrepare: function () {
    browser.manage().timeouts().pageLoadTimeout(9000);

    browser.manage().timeouts().implicitlyWait(9000);
}
};

//*Error Message <> Failed: Timed out Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'RANGA-DT', ip: '172.28.131.6', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{moz:profile=C:\Users\sranga\AppData\Local\Temp\rust_mozprofile.7BPiP8PPD71D, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0},pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=54.0, platformVersion=6.1, moz:processID=20000.0, browserName=firefox, javascriptEnabled=true, platformName=windows_nt}] Session ID: 094df1fd-7b62-49d4-9552-b47230c02d01 Stack: ScriptTimeoutError: Timed out Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'RANGA-DT', ip: '172.28.131.6', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{moz:profile=C:\Users\sranga\AppData\Local\Temp\rust_mozprofile.7BPiP8PPD71D, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=54.0, platformVersion=6.1, moz:processID=20000.0, browserName=firefox, javascriptEnabled=true, platformName=windows_nt}] Session ID: 094df1fd-7b62-49d4-9552-b47230c02d01 at WebDriverError (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\error.js:27:5) at ScriptTimeoutError (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\error.js:203:5) at Object.checkLegacyResponse (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\error.js:505:15) at parseHttpResponse (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\http.js:509:13) at doSend.then.response (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\http.js:440:13) at process._tickCallback (internal/process/next_tick.js:109:7) From: Task: Protractor.waitForAngular() - Locator: By(partial link text, Make a Payment) at thenableWebDriverProxy.schedule (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\webdriver.js:816:17) at ProtractorBrowser.executeAsyncScript_ (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\protractor\lib\browser.ts:609:24) at angularAppRoot.then (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\protractor\lib\browser.ts:643:23) at ManagedPromise.invokeCallback_ (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\promise.js:1366:14) at TaskQueue.execute_ (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\promise.js:2970:14) at TaskQueue.executeNext_ (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\promise.js:2953:27) at asyncRun (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\promise.js:2813:27) at C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\promise.js:676:7Error at ElementArrayFinder.applyAction_ (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\protractor\lib\element.ts:482:23) at ElementArrayFinder.(anonymous function) [as click] (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\protractor\lib\element.ts:96:21) at ElementFinder.(anonymous function) [as click] (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\protractor\lib\element.ts:873:14) at clickPaymentButton (C:\Users\sranga\em2_automation\Protractor\consumer\e2e\pages\payment\singlepayment.po.js:4:55) at Object. (C:\Users\sranga\em2_automation\Protractor\consumer\e2e\tests\payment\singlepayment.spec.js:20:15) at C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\jasminewd2\index.js:112:25 at new ManagedPromise (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\promise.js:1067:7) at ControlFlow.promise (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\promise.js:2396:12) at schedulerExecute (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\jasminewd2\index.js:95:18) at TaskQueue.execute_ (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\selenium-webdriver\lib\promise.js:2970:14) From: Task: Run it("should have a title") in control flow at Object. (C:\Users\sranga\em2_automation\Protractor\consumer\node_modules\jasminewd2\index.js:94:19) From asynchronous test: Error at Suite. (C:\Users\sranga\em2_automation\Protractor\consumer\e2e\tests\payment\singlepayment.spec.js:11:2) at Object. (C:\Users\sranga\em2_automation\Protractor\consumer\e2e\tests\payment\singlepayment.spec.js:7:1) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12)

1

1 Answers

1
votes

I have spent the past few days trying to upgrade to the lastest version of Firefox after having been stuck on FF V46 for some time due to the change in web drivers used by firefox. Looking at what you pasted in the comment there isn't enough information for me to say exactly what is wrong but I have personally experienced a number of issues with getting firefox to work in even reliable manner. But I will share what I have found so far. Protractor has 5 ways to setup a selenium server. Below I have specified what worked for me and then what did not.

Despite there being a number of ways to get protractor to run tests the only way I have been able to successfully do it with Firefox is by starting the standalone server through webdriver-manager, specify the seleniumAddress in my protractor.conf file and then using another terminal window to execute my tests.

I prefer not to globally install npm modules despite nearly every protractor tutorial under the sun saying in step #1 to run "npm install protractor -g"

What I did was to add this in my package.json file:

"scripts": { "e2e": "node node_modules/protractor/bin/webdriver-manager update && node node_modules/protractor/bin/webdriver-manager start &" }

You can execute this from your projects root directory by running "npm run e2e". This lets me locally update the lastest webdriver-manager drivers and launch a standalone selenium server at the default address. In your protractor.conf you need to make sure that you are configuring your protractor tests to connect to a selenium server that is already running by specifying the option seleniumAddress inside of exports.config, like this"

    exports.config = {
         // location of your E2E test specs
         specs: [
             'src/e2e/**/*.spec.js'
         ],   
         seleniumAddress: 'http://localhost:4444/wd/hub' //this tells protractor to connect to the server you started using 'npm run e2e' 
         directConnect: false,
         chromeOnly: false,
         capabilities: {
             'browserName': 'firefox',
         }, 
}

Once the server is up and the conf file is setup like this I am able to get firefox to run by starting my tests. I prefer starting the tests in a different terminal window so output from the tests doesn't get drowned in output from the selenium server. So far this is the only method in which I have been able to get firefox to run with (at the time of this writing) latest versions of FF and Protractor.

If interested here are things that failed for me

1) In the past the easiest way for me to use protracto was to use directConnect: true in my protractor.conf. This causes your script to directly connect to the browser specific driver on your system and start running tests. However using versions you mention above throws an error for my like this:

I/direct - Using FirefoxDriver directly... [13:23:08] E/launcher - Unable to parse new session response: {"value": {"sessionId":"a3a72e32-fe2f-e84f-a09b-68793eee8464","capabilities":{"acceptInsecureCerts":true,"browserName":"firefox","browserVersion":"54.0","moz:accessibilityChecks":false,"moz:processID":49834,"moz:profile":"/var/folders/b5/5kptwjxj0xsgdzw2rfs4dwyncmp_vb/T/rust_mozprofile.QacVydBwozMK","pageLoadStrategy":"eager","platformName":"darwin","platformVersion":"15.6.0","rotatable":false,"specificationLevel":0,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000}}}}

Granted this is what I get using a Mac and haven't tried it on a Windows machine yet but will have to try that once I get a chance.

2) Trying to specify the selenium standalone Jar in the protractor.conf file. Instead of using seleniumAddress in your protractor.conf according to the documentation you should be able to specify something like:

seleniumServerJar: '../node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.4.0.jar',

From what I understand this should launch a selenium server and the specified webdriver should connect to it but it seems like the server starts but the tests being ran by my grunt driver never seem to connect to the server and it just times out.