How to run Protractor specs on IE 11? - protractor

I have been trying to run protractor specs on IE 11,with following conf.js:
multiCapabilities: [
{
'browserName': 'internet explorer',
version: 11,
'ignoreProtectedModeSettings': true
// 'idle-duration':10000,
},
}],
And added this as well:
seleniumArgs: 'C:/Users/LJQAuser/AppData/Roaming/npm/node_modules/protractor/node_modules/webdriver-manager/selenium/IEDriverServer.exe',
And set directConnect to : false
But still its showing error:
Error in console is:
[12:38:42] I/local - Starting selenium standalone server...
[12:38:43] E/launcher - Error: Error: Server terminated early with status 1
at earlyTermination.catch.e (C:\Users\LJQAuser\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\remote\index.js:252:52)
at :null:null
at process._tickCallback (internal/process/next_tick.js:188:7)
Closing report
[12:38:43] E/launcher - Process exited with error code 100

There is tons of issues with internet explorer. Probably you wont be able to run it successfully.
There is alot of manual steps also to be applied.
Here is some basic guide how to setup:
Protractor test in IE
https://qavalidation.com/2017/11/run-protractor-test-ie-internet-explorer.html/
Good luck!

Related

Laravel 9 "The BLADE Language Server crashed 5 times in the last 3 minutes. The server will not be restarted."

I have this problem with Laravel Blade Snippets. As soon as I install Laravel Blade Snippet(Winnie Lin) VSC give me this 2 errors
1- "The BLADE Language Server crashed 5 times in the last 3 minutes. The server will not be restarted."
2- "A request has failed. See the output for more information."
If I click on "Go to output" it opens the terminal and this is showed up a few times:
"node:internal/modules/cjs/loader:368
throw err;
^
Error: Cannot find module 'c:\Users\MyUserName\.vscode\extensions\onecentlin.laravel-blade-1.32.0\server\node_modules\vscode-html-languageservice\node_modules\vscode-nls\lib\main.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:360:19)
at Module._findPath (node:internal/modules/cjs/loader:573:18)
at Module._resolveFilename (node:internal/modules/cjs/loader:973:27)
at Module._load (node:internal/modules/cjs/loader:832:27)
at c._load (node:electron/js2c/asar_bundle:5:13343)
at Module.require (node:internal/modules/cjs/loader:1059:19)
at require (node:internal/modules/cjs/helpers:102:18)
at c:\Users\MyUserName\.vscode\extensions\onecentlin.laravel-blade-1.32.0\server\node_modules\vscode-html-languageservice\lib\umd\parser\htmlScanner.js:16:15
at c:\Users\MyUserName\.vscode\extensions\onecentlin.laravel-blade-1.32.0\server\node_modules\vscode-html-languageservice\lib\umd\parser\htmlScanner.js:7:17
at Object.<anonymous> (c:\Users\MyUserName\.vscode\extensions\onecentlin.laravel-blade-1.32.0\server\node_modules\vscode-html-languageservice\lib\umd\parser\htmlScanner.js:13:3) {
code: 'MODULE_NOT_FOUND',
path: 'c:\\Users\\MyUserName\\.vscode\\extensions\\onecentlin.laravel-blade-1.32.0\\server\\node_modules\\vscode-html-languageservice\\node_modules\\vscode-nls\\package.json',
requestPath: 'vscode-nls'
}
[Info - 8:01:50 PM] Connection to server got closed. Server will restart."
I've added the preferences showed in the raccomanded settings as shown
"emmet.triggerExpansionOnTab": true, // enable tab to expanse emmet tags
"blade.format.enable": true, // if you would like to enable blade format
"[blade]": {
"editor.autoClosingBrackets": "always"
},
I've tried uninstall and re-install or restart but nothing.
Obviously in every .blade.php there's no auto tag generation or snippet of any sort
Thankyou guys!
I had the same problem. Uninstalled that plugin and used a similar one

Getting this error when running ng e2e on mac with visual studio code

Setup :
#angular/cli#8.1.2
#ionic/cli#6.12.3
cordova#10.0.0
npm#6.14.10
“protractor”: “~5.4.0
Mac OS : Catalina
This is the error I am getting
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
:information_source: 「wdm」: Compiled successfully.
[12:08:58] I/launcher - Running 1 instances of WebDriver
[12:08:58] I/direct - Using ChromeDriver directly...
[12:08:58] E/runner - Unable to start a WebDriver session.
[12:08:58] E/launcher - Error: Error: spawn Unknown system error -86
at ChildProcess.spawn (internal/child_process.js:403:11)
at Object.spawn (child_process.js:553:9)
at exec (/Users/sunilharan/Documents/Projects/IONIC/App_NAME/node_modules/selenium-webdriver/io/exec.js:116:27)
at /Users/sunilharan/Documents/Projects/IONIC/App_NAME/node_modules/selenium-webdriver/remote/index.js:219:25
at processTicksAndRejections (internal/process/task_queues.js:93:5)
[12:08:58] E/launcher - Process exited with error code 100
This same setup is working on another machine running on M1 chip. I have tried on different computers but not working on any of them except my M1 Macbook Pro.
This is an issue with the latest chromedriver on MacOS. Please see detailed resolutions in this ticket.
"As a general solution, simply avoid using the chromedriver that has _m1 in its filename if you are on an Intel mac."
OSX fix Selenium Chromedriver launch error spawn Unknown system error -86 Bad CPU type in executable?

chromedriver Only local connections are allowed

I try to start tests by webdriver-manager and protractor.
Verify versions:
Google Chrome 73.0.3683.86
ChromeDriver 73.0.3683.68
start webdriver-manager webdriver-manager start
and start protractor
I got error by protractor
enviroment: test
[12:20:23] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[12:20:23] E/driverProvider - Error code: 135
[12:20:23] E/driverProvider - Error message: unknown error: Chrome failed to start: exited abnormally
[12:20:23] E/driverProvider - Error: unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 4.9.0-8-amd64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 172 milliseconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'dev', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.0-8-amd64', java.version: '1.8.0_212'
Driver info: driver.version: unknown
at Hosted.<anonymous> (/usr/lib/node_modules/protractor/built/driverProviders/driverProvider.js:69:23)
at Generator.throw (<anonymous>)
at rejected (/usr/lib/node_modules/protractor/built/driverProviders/driverProvider.js:5:65)
at process._tickCallback (internal/process/next_tick.js:68:7)
[12:20:23] E/launcher - Process exited with error code 135
and info by webdriver-manager
12:19:38.934 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome",
"count": 1
}
12:19:38.947 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72) on port 15966
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
protractor.conf.js in project folder (where I execute command protractor --host https://MySite
let test_url = '';
let enviroment = process.env.NODE_ENV;
console.log('enviroment:', enviroment);
//console.log('process.env:', process.env);
let settings = {
seleniumAddress: 'http://localhost:4444/wd/hub',
//directConnect: true,
specs: ['./e2e/todo-spec.js'],
// Options to be passed to Jasmine-node.
params: {
host: 'http://localhost:3000'
},
capabilities: {
browserName: 'chrome'
},
onPrepare: function() {
// The require statement must be down here, since jasmine-reporters#1.0
// needs jasmine to be in the global and protractor does not guarantee
// this until inside the onPrepare function.
var jasmineReporters = require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmineReporters.JUnitXmlReporter('xmloutput', true, true)
);
},
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
}
if(process.env.hasOwnProperty('npm_config_host') && process.env.npm_config_host){
settings.params.host = process.env.npm_config_host
}
exports.config = settings;
In your chromeOptions, can you try adding --no-sandbox and --disable-dev-shm-usage and then try running the tests . Also try downgrading the browser version to see if the code is working as expected.
"chromeOptions": {
"args": ['--no-sandbox','--disable-dev-shm-usage'],
Remove seleniumAddress: fomr your config and add the below one.
exports.config = {
directConnect: true,
}
When you add dirctConnect=true you don't need to start the webdriver separately.
Hope it help you
Please make sure you have
127.0.0.1 localhost
in your /etc/hosts file.
To check it, you should go to the terminal and run
sudo vi /etc/hosts
type your user password and paste
127.0.0.1 localhost
to an empty row.
Additionally, please make sure you have ChromeDriver -or the driver of the browser you intend to use- is installed and your program knows the path of ChromeDriver.
You can follow the steps explained here https://www.browserstack.com/guide/run-selenium-tests-using-selenium-chromedriver.

ECONNREFUSED Webdriver errors in eclipse when running Protractor

So, I was following this tutorial on getting my existing protractor files imported to Eclipse as Java project, installing angular/protractor configurations on eclipse and running the files:
https://www.youtube.com/watch?v=8dZ3isYcthI
But then I got into the weeds on this error: Error while running conf.js file from Eclipse
In attempt to resolve it, following instructions on the youtube tutorial, I replaced the selenium webdriver folder in Eclipse with the selenium webdriver folder in my node modules folder in AppData by dragging and dropping
Now my conf.js file will not run as protractor on Eclipse even though the file will execute successfully from the command line. Error is:
(node:53640) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[15:11:38] I/launcher - Running 1 instances of WebDriver
[15:11:38] I/hosted - Using the selenium server at http://localhost:4444 /wd/hub
[15:11:39] E/launcher - Error code: 135
[15:11:39] E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
[15:11:39] E/launcher - Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444 at ClientRequest. (C:\Workspace\testUltimateQASite\node_modules\selenium-webdriver\http\index.js:238:15)
The js line it is pointing to in the index file is the last line of this function:
request.on('error', function(e) {
if (e.code === 'ECONNRESET') {
setTimeout(function() {
sendRequest(options, onOk, onError, opt_data, opt_proxy);
}, 15);
} else {
var message = e.message;
if (e.code) {
message = e.code + ' ' + message;
}
onError(new Error(message));
}
});
My conf.js file is as follows:
// conf.js
//var jasmineReporters = require('jasmine-reporters');
var os = require('os'); os.tmpDir = os.tmpdir;
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['qaSpec.js'],
//module.exports = {
params: {
url : 'http://phptravels.com/demo/'
/* login: {
url: 'http://phptravels.com/demo/',
username: 'juliel#ibm.com',
password: 'password'
}*/
}
};
The error is basically stating that your Selenium server doesn't seem to be running. Notice how you are seeing a connection refused error.
Please check if you have started the selenium server as described in the official documentation here : http://www.protractortest.org/#/tutorial#setup
For more information on setting up eclipse and protractor you might want to refer here as well :https://github.com/angelozerr/angularjs-eclipse/wiki/Protractor
I tried to understand your project's architecture by reading post several times and still got a bit confused.
I am not sure how do you manage Webdriver?
For Protractor project I would recommend using proper NodeJS project's structure as well as using any JS task runner. Grunt might be a good choice.
There are plenty Webdriver Manager plugins as well as Protractor managers so you will be able to load your project's dependencies and run test with single Grunt command.
UPDATE: this demo project might be useful in understanding the use of Grunt and its dependencies in Angular project's architecture.

Protractor does not close browser when a server is unavailable

I do e2e testing with protractor. When my application is running on a server the tests pass fine and a browser is closed afterward, however when the server is down the browser remains (Firefox, Chrome). It is OK on my local machine but I am experimenting with running tests on remote CI machine and afraid that the tests can spawn multiple browser windows if the server fails to run. How to make sure protractor closes the browser window in such situation?
Here is my configuration:
exports.config = {
allScriptsTimeout: 11000,
specs: [
'../test/e2e/*.js'
],
capabilities: {
'browserName': 'firefox'
},
baseUrl: 'http://localhost:8000/',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
and the test is:
'use strict';
describe('typicaClient', function() {
browser.get('index.html');
it('test', function() {
expect('str').toMatch('str');
});
});
Protractor leaves browser open on those errors which it doesn't recognize and cannot handle.
Check out the example below. This error thrown by spawn() process is unhandled by Protractor and it exits with an error code - 199
describe('sample test', function(){
it('Sample Check', function(){
browser.get("http://www.protractortest.org/#/");
browser.sleep(5000);
var terminal = require('child_process').spawn('34e3545')
});
});
Output:
[18:26:46] I/local - Starting selenium standalone server...
[18:26:46] I/launcher - Running 1 instances of WebDriver
[18:26:46] I/local - Selenium standalone server started at http://192.168.1.5:61146/wd/hub
Started
[18:26:49] E/launcher - spawn 34e3545 ENOENT
[18:26:49] E/launcher - Error: spawn 34e3545 ENOENT
at exports._errnoException (util.js:873:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
[18:26:49] E/launcher - Process exited with error code 199
To avoid these , handle gracefully the error at non-protractor commands
describe('sample test', function(){
it('Sample Check', function(){
browser.get("http://www.protractortest.org/#/");
browser.sleep(5000);
var terminal = require('child_process').spawn('34e3545').on('error', function(err) {
fail('Test is failing because we provided an invalid process')
});
});
});
Output in this case:
[18:57:22] I/local - Starting selenium standalone server...
[18:57:22] I/launcher - Running 1 instances of WebDriver
[18:57:22] I/local - Selenium standalone server started at http://192.168.1.5:49867/wd/hub
Started
F
Failures:
1) sample test Sample Check
Message:
Failed: Test is failing because we provided an invalid process
Stack:
Error: Failed: Test is failing because we provided an invalid process
at ChildProcess.<anonymous> (C:\Users\ayannam\WebstormProjects\demo\errorHandle.js:7:13)
at emitOne (events.js:77:13)
at ChildProcess.emit (events.js:169:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
1 spec, 1 failure
Finished in 6.582 seconds
See it this case Un-handled exception is handled and Protractor throws an error code - 1 which is gracefully handled