Can't start protractor with firefox - firefox

When I start protractor firefox opens, but my tests does not execute. After a while I get time out Error. Can you help me where is the problem? (Works fine with chrome).
OS: Windows 8.1 x64
protractor --version
Version 4.0.2
firefox version 48.0
protractor.config.js:
exports.config = {
directConnect: true,
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['*.spec.js'],
baseUrl: 'http://localhost:9876',
capabilities: {
'browserName': 'firefox'
}
};
First i start webdriver:
>webdriver-manager start
Then in other cmd, I run protractor:
>protractor protractor.conf.js
Output:
X:\e2e>protractor protractor.conf.js
[15:38:25] I/direct - Using FirefoxDriver directly...
[15:38:25] I/launcher - Running 1 instances of WebDriver
[15:39:11] E/launcher - Timed out waiting for the WebDriver server at http://127
.0.0.1:55485/hub
[15:39:11] E/launcher - Error: Timed out waiting for the WebDriver server at htt
p://127.0.0.1:55485/hub
at Error (native)
at onError (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_
modules\selenium-webdriver\http\util.js:87:11)
at ManagedPromise.invokeCallback_ (C:\Users\<USER>\AppData\Roaming\npm\node_m
odules\protractor\node_modules\selenium-webdriver\lib\promise.js:1379:14)
at TaskQueue.execute_ (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protr
actor\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (C:\Users\<USER>\AppData\Roaming\npm\node_modules\p
rotractor\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_modules\s
elenium-webdriver\lib\promise.js:2775:27
at C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_modules\s
elenium-webdriver\lib\promise.js:639:7
at process._tickCallback (node.js:369:9)
From: Task: WebDriver.createSession()
at Function.createSession (C:\Users\<USER>\AppData\Roaming\npm\node_modules\p
rotractor\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
at Driver (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_m
odules\selenium-webdriver\firefox\index.js:386:38)
at Direct.getNewDriver (C:\Users\<USER>\AppData\Roaming\npm\node_modules\prot
ractor\built\driverProviders\direct.js:75:26)
at Runner.createBrowser (C:\Users\<USER>\AppData\Roaming\npm\node_modules\pro
tractor\built\runner.js:187:43)
at C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\built\runner.j
s:261:30
at _fulfilled (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\no
de_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\Users\<USER>\AppData\Roaming\npm\node_module
s\protractor\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\Users\<USER>\AppData\Roaming\npm\node_
modules\protractor\node_modules\q\q.js:796:13)
at C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_modules\q
\q.js:556:49
at runSingle (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\nod
e_modules\q\q.js:137:13)
[15:39:11] E/launcher - Process exited with error code 199

Firefox 48 is not yet supported by latest version of protractor , please downgrade your firefox to 47.0.1 and try it would certainly work!

Install the latest version of Firefox and protractor .
Open the command line in admin mode if you have installed Firefox inside of program files to avoid potential access errors .
Use the below mentioned capabilities in your conf.js
exports.config = {
framework: 'jasmine',
directConnect: false, //Start protractor without start the selenium server using webdriver-manager start. default value is fales
//This is only for chrome and firefox and use drivers instead of selenium server
capabilities: {
browserName: 'firefox',
'moz:firefoxOptions': {
args: ['--verbose'],
binary: 'C:/Program Files/Mozilla Firefox/firefox.exe'
//Need to start cmd via admin mode to avoid permission error
}
},
//set to true So each spec will be executed in own browser instance. default value is false
//restartBrowserBetweenTests: true,
jasmineNodeOpts: {
//Jasmine provides only one timeout option timeout in milliseconds don't add ;
defaultTimeoutInterval: 180000
},
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['src/com/sam/scriptjs/iframes.spec.js']
}

Related

Process exited with error code 199 - unable to launch Firefox from protractor

Having trouble to launch Firefox browser from Protractor. getting error
E/launcher - Unable to create new service: GeckoDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
Most probable reason is your driver version and browser are mismatched.
I'm using geckodriver-v0.28.0.exe and browser version is 83.0 (64-bit)
Config:
jvmArgs: [
'-Dwebdriver.gecko.driver=./src/driver/geckodriver-v0.28.0.exe'
],
directConnect: false,
multiCapabilities: [
{
browserName: 'firefox'
}
],

geckodriver not launching firefox

I am using firefox v 48.0.2 and am trying to get my selenium (selenium-server v2.53) remotedriver automated tests to run on firefox, I have geckodriver 0.9.0 installed and when i go through the documentation on the github readme and run this command: (on mac osx 10.11.3)
geckodriver -b /Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin
i get this error message:
thread '< main >' panicked at 'called Result::unwrap() on an Err value: Io(Error { repr: Os { code: 48, message: "Address already in use" } })', ../src/libcore/result.rs:746
note: Run with RUST_BACKTRACE=1 for a backtrace.
ive tried ignoring this step but when i run my tests firefox does not launch, i have ensured that my webdriver capabilities include marrionette: true
WebDriver:
browser: 'firefox'
clear_cookies: false
restart: false
window_size: 414x736
marionette: true
other than that i can not find any documentation to lead me in the correct direction, did i perhaps over look something? any help is greatly appreciated!
I am also using codeception to handle my tests (php)
EDIT
I was able to get this command to work after killing the process that was listening on port 4444:
geckodriver -b /Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin
But even with that running Firefox is still not launching

Protractor + Jasmine 2

I have config and specs files at shared folder of remote server. I run tests from local machine via console:
C:\Users\User>protractor \remoteServer\AutoSPA\config\protractor.conf.js
With jasmine framework all works good, but if I set framework: 'jasmine2' in protractor.conf.js tests don`t run:
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://10.17.175.168:50910/wd/hub
Started
No specs found
Finished in 0.001 seconds
Uncaught exception: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
[launcher] Process exited with error code 1
EXAMPLE:
conf.js:
exports.config = {
specs: ['./test.js'],
capabilities : {'browserName' : 'chrome'},
framework: 'jasmine2',
jasmineNodeOpts: {showColors: true}
};
test.js in the same folder:
describe("test", function(){
it("navigate", function(){
browser.get("https://angularjs.org/")
})
});
if it's local folder it works correctly, but if it's remote folder it doesn't find spec test.js.
I investigated and debug a little bit more and found out that Jasmine 1.3 used FS and Path for specs search, but Jasmine 2 used GLOB. Glob doesn't work with remote paths.

Install Latest Version of Firefox on Travis And Run with Protractor

Travis installs Firefox 31.0esr by default, but we want to always use the latest version. The reference here says it should be pretty straight forward, but it doesn't seem to actually install, rather it just seems to download the tar file. Protractor still uses Firefox version 31.0esr when it runs.
travis.yml
addons:
firefox: "latest"
protractor.conf.js
capabilities: {
'browserName': 'firefox'
}
Logs:
Initial Firefox install still happens:
[34m[1mInstalled Firefox version[0m
firefox 31.0esr
... the addon section kicks in and downloads the file fine, before the before_install section as expected:
[0Ktravis_fold:start:install_firefox
[0K$ export FIREFOX_SOURCE_URL='https://download.mozilla.org/?product=firefox-latest&lang=en-US&os=linux64'
[33;1mInstalling Firefox latest[0m
travis_time:start:0dff0345
[0K$ wget -O /tmp/firefox-latest.tar.bz2 $FIREFOX_SOURCE_URL
--2016-01-04 23:29:18-- https://download.mozilla.org/?product=firefox-latest&lang=en-US&os=linux64
Resolving download.mozilla.org (download.mozilla.org)... 52.20.26.65
Connecting to download.mozilla.org (download.mozilla.org)|52.20.26.65|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://download.cdn.mozilla.net/pub/firefox/releases/43.0.3/linux-x86_64/en-US/firefox-43.0.3.tar.bz2 [following]
--2016-01-04 23:29:18-- http://download.cdn.mozilla.net/pub/firefox/releases/43.0.3/linux-x86_64/en-US/firefox-43.0.3.tar.bz2
Resolving download.cdn.mozilla.net (download.cdn.mozilla.net)... 23.0.160.35, 23.0.160.65
Connecting to download.cdn.mozilla.net (download.cdn.mozilla.net)|23.0.160.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 52525181 (50M) [application/x-bzip2]
Saving to: `/tmp/firefox-latest.tar.bz2'
0% [ ] 0 --.-K/s
33% [============> ] 17,618,150 84.0M/s
67% [=========================> ] 35,556,926 84.7M/s
100%[======================================>] 52,525,181 83.6M/s in 0.6s
2016-01-04 23:29:18 (83.6 MB/s) - `/tmp/firefox-latest.tar.bz2' saved [52525181/52525181]
travis_time:end:0dff0345:start=1451950158289192377,finish=1451950158979104185,duration=689911808
[0Ktravis_fold:end:install_firefox
... then when protractor starts:
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://172.17.1.120:39697/wd/hub
Browser details:
Platform: LINUX
Browser Name: firefox
Browser Version: 31.0
I have a sneaking suspicion that even though the Travis docs says the addon section installs the file too, there is no indication this actually happens so I don't think it does.
For interests sake, this is how we print out the system information when protractor starts:
this.getBrowserCapabilities = function() {
return browser.getCapabilities().then(function (s) {
var browserCapabilities = {
browserName: '',
browserVersion: '',
platform: ''
};
browserCapabilities.platform = s.caps_.platform;
browserCapabilities.browserName = s.caps_.browserName;
browserCapabilities.browserVersion = s.caps_.version;
return browserCapabilities;
});
};
I stumbled over the same issue myself and I can confirm that Travis only downloads the specified firefox version.
This is what I did in my build script to use the downloaded version (in my example 43.0).
First, configure the addon in your .travis.yml file:
addons:
firefox: "43.0"
Now before runing your tests execute these steps:
echo "Extracting firefox and setting PATH variable..."
tar -xjf /tmp/firefox-43.0.tar.bz2 --directory /tmp
export PATH="/tmp/firefox:$PATH"
echo "Using firefox version `firefox --version`"
For a working example see also:
https://github.com/astehlik/typo3-extension-news_richteaser/blob/master/.travis.yml
I'm using Selenium in my case but I guess it should work no different with protractor.

Karma + Xvfb + Firefox does not work anymore

I've got a problem with my CI setup.
Since a couple of days Firefox doesn't run our Jasmine tests with Karma anymore.
But Chrome does - so the error should not depend on the tests themselves.
On my development environment it runs as well.
I did not change anything on the CI-server (Ubuntu).
What happens:
Firefox is connecting to the web-server and establishes a session.
But the tests are not executed.
What I already tried:
I already changed the timeout.
I already restarted the machine (a couple of times).
And I already reinstalled firefox.
Do you have an idea, what causes this strange behaviour or how I can debug this?
We are using
karma#0.12.37
karma-jasmine#0.3.5
karma-firefox-launcher#0.1.6
Firefox v.38.0
Ubuntu
nodejs v.0.10.25
npm v 1.3.10
Xvfb
karma.conf.js
module.exports = function(config) {
config.set({
browserNoActivityTimeout: 100000,
basePath: 'src/main/webapp/',
singleRun: true,
// autoWatch: true,
logLevel: config.LOG_DEBUG,
files: [
'assets/libs/jquery/dist/jquery.min.js',
'assets/libs/angular/angular.min.js',
'assets/libs/angular-mocks/angular-mocks.js',
'assets/libs/**/*.min.js',
'app/app.js',
'app/**/*.js',
'app/directives/*/*.html',
'app/directives/*/*.js',
'../../test/frontend/**/*.js', {
pattern: 'assets/libs/**/*.map',
included: false
},
'app/views/*.html'
],
preprocessors: {
'app/views/*.html': 'ng-html2js',
'app/directives/*/*.html': 'ng-html2js'
},
frameworks: ['jasmine'],
browsers: [
'Firefox'
],
plugins: [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-safari-launcher',
'karma-ie-launcher',
'karma-jasmine',
'karma-junit-reporter',
'karma-ng-html2js-preprocessor'
],
reporters: ['progress', 'junit'],
junitReporter: {
outputFile: '../../../build/test-results/karma-test-results.xml'
},
ngHtml2JsPreprocessor: {
moduleName: 'myc-templates'
}
});
};
Output of 'xvfb-run karma start'
INFO [karma]: Karma v0.12.37 server started at http://localhost:9876/
INFO [launcher]: Starting browser Firefox
DEBUG [temp-dir]: Creating temp dir at /tmp/karma-70931573
DEBUG [launcher]: firefox http://localhost:9876/?id=70931573 -profile /tmp/karma-70931573 -no-remote
DEBUG [web-server]: serving: /var/lib/jenkins/jobs/MYC/workspace/node_modules/karma/static/client.html
DEBUG [web-server]: serving: /var/lib/jenkins/jobs/MYC/workspace/node_modules/karma/static/karma.js
DEBUG [web-server]: serving: /var/lib/jenkins/jobs/MYC/workspace/node_modules/karma/static/favicon.ico
DEBUG [web-server]: upgrade /socket.io/1/websocket/5wtT2gW7_XuaTRZ3Gctt
DEBUG [karma]: A browser has connected on socket 5wtT2gW7_XuaTRZ3Gctt
INFO [Firefox 38.0.0 (Ubuntu 0.0.0)]: Connected on socket 5wtT2gW7_XuaTRZ3Gctt with id 70931573
DEBUG [launcher]: Firefox (id 70931573) captured in 3.542 secs
DEBUG [web-server]: serving: /var/lib/jenkins/jobs/MYC/workspace/node_modules/karma/static/context.html
DEBUG [Firefox 38.0.0 (Ubuntu 0.0.0)]: Disconnected during run, waiting 2000ms for reconnecting.
WARN [Firefox 38.0.0 (Ubuntu 0.0.0)]: Disconnected (1 times)
DEBUG [karma]: Run complete, exiting.
DEBUG [launcher]: Disconnecting all browsers
DEBUG [reporter.junit]: JUnit results written to "/var/lib/jenkins/jobs/MYC/workspace/build/test-results/karma-test-results.xml".
DEBUG [launcher]: Process Firefox exited with code 0
DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-70931573
npm ERR! weird error 1
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
Any tipps or ideas how to solve this are very much appreciated ;-)
Thanks, Sebastian

Resources