No se puede ejecutar Protractor-ECONNREFUSED connect ECONNREFUSED
Estoy tratando de aprender AngularJS. Como parte de esto, quiero aprender a usar pruebas de extremo a extremo. Actualmente, tengo una estructura de directorios como esta:
node_modules
.bin
...
protractor
...
node_modules
.bin
adam-zip
glob
minijasminenode
optimist
saucelabs
selenium-webdriver
protractor
config.js
src
tests
test.e2e.js
Mi configuración.el archivo js tiene el siguiente aspecto:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
},
specs: [
'../src/tests/test.e2e.js'
],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
Prueba.e2e.js se parece a lo siguiente:
'use strict';
describe('My Sample', function () {
driver = protractor.getInstance();
beforeEach(function () {
driver.get('#/');
});
it('My First Test', function () {
message = "Hello.";
expect(message).toEqual('World.');
});
});
Cuando intento ejecutar mis pruebas de extremo a extremo usando protractor, corro el siguiente comando desde la línea de comandos:
node_modules\.bin\protractor protractor\config.js
Cuando corro ese comando, recibo el siguiente error:
C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1542
throw error;
^
Error: ECONNREFUSED connect ECONNREFUSED
at ClientRequest.<anonymous> (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:12
7:16)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at Socket.socketErrorListener (http.js:1528:9)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:415:13)
==== async task ====
WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriv
er\lib\webdriver\webdriver.js:130:49)
at Function.webdriver.WebDriver.createSession (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver
\lib\webdriver\webdriver.js:110:30)
at Builder.build (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver\builder.js:105:20)
at runJasmineTests (C:\Src\MyProject\node_modules\protractor\lib\runner.js:191:45)
at C:\Src\MyProject\node_modules\protractor\lib\runner.js:255:5
at C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1178:15
at webdriver.promise.ControlFlow.runInNewFrame_ (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriv
er\lib\webdriver\promise.js:1438:20)
at notify (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:328:12)
at then (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:377:7)
¿Qué soy Estoy haciendo mal?
10 answers
Resolví esto con flag standalone flag:
webdriver-manager start --standalone
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-01-14 21:57:55
Lo conseguí trabajando eliminando la siguiente línea de mi configuración.js
seleniumAddress: 'http://localhost:4444/wd/hub',
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-13 07:13:46
¿Está ejecutando un servidor selenium? El README de git establece lo siguiente:
WebdriverJS no incluye de forma nativa el servidor selenium - debe iniciar un servidor selenium independiente. Todo lo que necesita es el último selenium-server-standalone.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-11-18 22:35:31
El mensaje de error se debe a lo siguiente:
[ECONNREFUSED] El intento de conexión se ignoró (porque el destino no está escuchando conexiones) o se rechazó explícitamente.
Compruebe la URL del administrador de Webdriver. La URL predeterminada es:
http://localhost:4444/wd/hub
Use un proceso en segundo plano para ejecutar el administrador de webdriver, luego ejecute protractor:
Start-Process webdriver-manager start -passthru
protractor conf.js
Esto iniciará un servidor Selenium y generará un montón de registros de información. La prueba del transportador envíe solicitudes a este servidor para controlar un navegador local. Deje este servidor funcionando
Referencias
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-26 13:48:19
Para mí, esto había sucedido debido a versiones incompatibles de Node y Protractor.
Mi solución -
- Actualizar nodo a la última versión (v7.0.0 en mi caso)
Siga los pasos dados aquí https://stackoverflow.com/a/19333717/1902831
- Instale la última versión de protractor (4.0.10 en mi caso) usando:
Npm install-g transportador
- Abra otra terminal y ejecute estos orden:
Actualización del administrador de Webdriver
Webdriver-manager start
- Ejecute pruebas en otro terminal usando:
Transportador conf.js
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 12:25:54
Si está utilizando el plugin npm protractor-webdriver grunt ( https://www.npmjs.org/package/grunt-protractor-webdriver ) usted puede exeprience mismo tipo de error. Esto se debe a la terminación de webdriver justo antes de que finalice la prueba. La prueba se ejecuta correctamente y luego tienes un mensaje como :
Session deleted: Going to shut down the Selenium server
Shutting down Selenium server: http://127.0.0.1:4444
Shut down Selenium server: http://127.0.0.1:4444 (OKOK)
d:\Projets\Clouderial\nodeProjects\cld-apps\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:145
callback(new Error(message));
^
Error: ECONNREFUSED connect ECONNREFUSED
at ClientRequest.<anonymous> (d:\Projets\Clouderial\nodeProjects\cld-apps\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:145:16)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at Socket.socketErrorListener (http.js:1547:9)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:440:14
at process._tickCallback (node.js:419:13)
Resuelvo esto usando la opción keepAlive en el plugin grunt.
Aquí está mi archivo de Grunt.js config:
protractor_webdriver: {
options: {
keepAlive : true // True to keep the webdriver alive
},
start: {
},
},
...
Espero que esto ayude a alguien.
JM.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-10-15 22:12:33
También me enfrenté al mismo problema,el truco que funcionó para mí es usar dos ventanas cmd,manteniendo la una abierta después de escribir webdriver-manager start
y sin presionar enter key (si se presiona la tecla enter el servidor selenium se apaga,no sé por qué) abra otra ventana cmd y llame a sus pruebas.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-03-26 03:44:41
@Alexandros Spyropoulos, me tomó bastante tiempo averiguar cómo ejecutar protractor y creo que tuvimos el mismo problema. Debe abrir una pestaña de terminal y ejecutar webdriver-manager start standalone standalone. A continuación, abra otra etiqueta de terminal y ejecute protractor ***.conf.js
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-03-18 18:14:11
Con la esperanza de que pudiera ayudar a alguien: yo había estado teniendo el mismo problema - encontrándome con ECONNREFUSED usando grunt-protractor-runner
. El matiz de mi caso es que estaba ejecutando todo mi entorno E2E (archivos de prueba, aplicación web y todo el backend) dentro de un contenedor Docker.
He intentado ejecutar transportador
- con y sin tarea adicional
grunt-protractor-webdriver
para poner en marcha webdriver 'manualmente' (sin diferencia); - con y sin habilitar la configuración
directConnect
ykeepAlive
(sin pasar por el selenio y resultando en accidentes relacionados con Chromedriver, uno de los cuales fue descrito aquí ).
La solución era bastante simple: aumentar la cantidad de memoria asignada al contenedor. En mi máquina host Windows 10, realicé los siguientes pasos:
- Ejecute
VBoxManage.exe modifyvm default --memory 8192
(a través de un script de shell personalizado) antes de iniciar el docker-machine (a través del script de inicio rápido de Docker, que es equivalente adocker-machine start
). (Gracias a esto respuesta). - Cambiando mi script de shell para ejecutar mi contenedor predeterminado, agregando el argumento
--shm-size=4G
a mi comandodocker run
. (Véase docs)- Puede verificar si funcionó ejecutando
df -h
en su máquina invitada, comprobando la cantidad de memoria montada en/dev/shm
.
- Puede verificar si funcionó ejecutando
Como resultado, ya no tengo errores aparentemente inexplicables como ECONNREFUSED.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 10:31:20
Si ejecuta la demostración provista del transportador, debería intentar ejecutar la configuración del transportador en el mismo símbolo del sistema que selenium. Intente ejecutar selenium server y protractor por separado.
Asegúrese de que first selenium se ejecuta siguiendo el comando.
webdriver-manager start --standalone
Y ejecute el transportador en una ventana de comandos separada.
protractor conf.js
(En mi caso conf.js era el archivo de configuración)
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-03-09 22:13:09