angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

Running Protractor tests on Webdriver 2.47.1 gets - Error: Server terminated early with status 1 #2638

Closed elliottsj closed 8 years ago

elliottsj commented 8 years ago

From https://github.com/SeleniumHQ/selenium/issues/1191:

Steps:

  1. Install Protractor 2.5.1 via npm
  2. Update webdriver/chrome: webriver-manager update (installs WebdriverJS 2.47.1)
  3. Run any Protractor test

Results: Two of four people on my team get the error below, and cannot ever run the tests until they downgrade webdriver. It works fine for the other two machines.

Impact:

Downgrading Webdriver to 2.45.0 fixes the problem. This occurs for 1/2 my team, and I found the same issue on StackOverflow

Error:

Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
[launcher] Process exited with error code 1
/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/async/nexttick.js:41
goog.global.setTimeout(function() { throw exception; }, 0);
                                          ^
Error: Server terminated early with status 1
  at Error (native)
  at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/remote/index.js:204:25
  at promise.ControlFlow.runInFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1857:20)
  at goog.defineClass.notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2448:25)
  at promise.Promise.notify_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:564:12)
  at Array.forEach (native)
  at promise.Promise.notifyAll_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:553:15)
  at goog.async.run.processWorkQueue (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/async/run.js:130:15)
  at runMicrotasksCallback (node.js:337:7)
  at process._tickCallback (node.js:355:11)

This is affecting a coworker's machine, but not my own :confused:

Downgrading to webdriver v2.45.0 (i.e. protractor v2.2.0) is not an option for us since we have upgraded to Node.js v4.2.

qualityshepherd commented 8 years ago

Glad I'm not alone! Thanks @elliottsj

cecchisandrone commented 8 years ago

The same is happening in my team...didn't discover the reason :(

mjgpy3 commented 8 years ago

Same issue here

sjelin commented 8 years ago

Can people running into this problem do the following:

  1. npm install selenium-webdriver@2.47.0
  2. Run the following

    var webdriver = require('selenium-webdriver');
    
    var driver = new webdriver.Builder().
       usingServer('http://localhost:4444/wd/hub').
       withCapabilities({
         'browserName': 'chrome',
       }).build();
    
    driver.get('http://www.google.com');
    driver.quit();
  3. Let me know what happens
elliottsj commented 8 years ago
❯ npm install selenium-webdriver@2.47.01
npm ERR! Darwin 15.0.0
npm ERR! argv "/Users/spencerelliott/.nvm/versions/node/v4.2.1/bin/node" "/Users/spencerelliott/.nvm/versions/node/v4.2.1/bin/npm" "install" "selenium-webdriver@2.47.01"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7

npm ERR! version not found: selenium-webdriver@2.47.1
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
elliottsj commented 8 years ago
// index.js
var webdriver = require('selenium-webdriver');

var driver = new webdriver.Builder().
    usingServer('http://localhost:4444/wd/hub').
    withCapabilities({
      'browserName': 'chrome',
    }).build();

driver.get('http://www.google.com');
driver.quit();
❯ npm install selenium-webdriver@2.47.0
...
❯ npm install selenium-standalone@latest -g
...
❯ selenium-standalone install
----------
selenium-standalone installation starting
----------

---
selenium install:
from: http://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.1.jar
to: /Users/spencerelliott/.nvm/versions/node/v4.2.1/lib/node_modules/selenium-standalone/.selenium/selenium-server/2.47.1-server.jar
---
chrome install:
from: http://chromedriver.storage.googleapis.com/2.18/chromedriver_mac32.zip
to: /Users/spencerelliott/.nvm/versions/node/v4.2.1/lib/node_modules/selenium-standalone/.selenium/chromedriver/2.18-x64-chromedriver

selenium-standalone installation [====================] 100% 0.0s

-----
selenium-standalone installation finished
-----
❯ selenium-standalone start
16:17:17.043 INFO - Launching a standalone Selenium Server
Setting system property webdriver.chrome.driver to /Users/spencerelliott/.nvm/versions/node/v4.2.1/lib/node_modules/selenium-standalone/.selenium/chromedriver/2.18-x64-chromedriver
16:17:17.130 INFO - Java: Oracle Corporation 25.45-b02
16:17:17.130 INFO - OS: Mac OS X 10.11 x86_64
16:17:17.150 INFO - v2.47.1, with Core v2.47.1. Built from revision 411b314
16:17:17.263 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC
16:17:17.264 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC
16:17:17.265 INFO - Driver class not found: com.opera.core.systems.OperaDriver
16:17:17.266 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
16:17:17.468 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
16:17:17.469 INFO - Selenium Server is up and running
Selenium started
16:17:19.735 INFO - Executing: [new session: Capabilities [{browserName=chrome}]])
16:17:19.761 INFO - Creating a new session for Capabilities [{browserName=chrome}]
Starting ChromeDriver 2.18.343837 (52eb4041461e46a6b73308ebb19e85787ced4281) on port 4370
Only local connections are allowed.
16:17:22.308 INFO - Done: [new session: Capabilities [{browserName=chrome}]]
16:17:22.334 INFO - Executing: [get: http://www.google.com])
16:17:23.512 INFO - Done: [get: http://www.google.com]
16:17:23.521 INFO - Executing: [delete session: 32ea1aaa-c961-4328-9829-0b10788046f1])
16:17:24.101 INFO - Done: [delete session: 32ea1aaa-c961-4328-9829-0b10788046f1]

In another tab:

❯ npm install selenium-webdriver@2.47.0
...
❯ node index.js

Chrome then opens, navigates to google.com, then closes.

@chriswong929: Can you do the same and post here?

sjelin commented 8 years ago

@elliottsj Sorry for the incomplete post and incorrect version. Sounds like webdriver is working fine on your machine (at least those commands). To confirm, you're encountering this problem with all protractor tests?

chriswong929 commented 8 years ago

Running the same commands above, I get a different result.

// index.js
var webdriver = require('selenium-webdriver');

var driver = new webdriver.Builder().
    usingServer('http://localhost:4444/wd/hub').
    withCapabilities({
      'browserName': 'chrome',
    }).build();

driver.get('http://www.google.com');
driver.quit();
❯ npm install selenium-webdriver@2.47.0
...
❯ npm install selenium-standalone@latest -g
...
❯ selenium-standalone install
----------
selenium-standalone installation starting
----------

---
selenium install:
from: http://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.1.jar
to: /Users/spencerelliott/.nvm/versions/node/v4.2.1/lib/node_modules/selenium-standalone/.selenium/selenium-server/2.47.1-server.jar
---
chrome install:
from: http://chromedriver.storage.googleapis.com/2.18/chromedriver_mac32.zip
to: /Users/spencerelliott/.nvm/versions/node/v4.2.1/lib/node_modules/selenium-standalone/.selenium/chromedriver/2.18-x64-chromedriver

selenium-standalone installation [====================] 100% 0.0s

-----
selenium-standalone installation finished
-----
❯ selenium-standalone start
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/grid/selenium/GridLauncher : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
/Users/chriswong/.nvm/versions/node/v4.2.1/lib/node_modules/selenium-standalone/bin/selenium-standalone:56
        throw err;
        ^

Error: Another Selenium process is already running
    at ChildProcess.errorIfNeverStarted (/Users/chriswong/.nvm/versions/node/v4.2.1/lib/node_modules/selenium-standalone/lib/start.js:111:15)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
sjelin commented 8 years ago

Is webdriver-manager running? if so close it

elliottsj commented 8 years ago

@chriswong929 didn't have webdriver-manager running, but installing java through brew cask seems to fix it!

brew update
brew cask install java

Then selenium starts successfully and webdriver opens Chrome as expected.

So, seems to be some incompatibility with the standard OS X Java installation...? Very strange :confused:

Turns out not to be a protractor issue though

sjelin commented 8 years ago

@elliottsj You have no problems running Protractor tests now?

elliottsj commented 8 years ago

@sjelin Nope, everything seems to work now. Thanks!

elhoyos commented 8 years ago

I just experienced the same situation in OS X 10.10.5 after updating standard Java installation.

I got to run my tests after installing it from homebrew as @elliottsj recommends.

$ java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

Using protractor@2.5.1 and selenium-webdriver@2.47.0.

area commented 8 years ago

EDIT: I believe that upgrading java through brew did solve my issue, but there was also an issue with my SOCKS proxy that was preventing a required connection which made it look like this wasn't the case.

This hasn't been an issue with the proxy in the past, so I think something has changed somewhere, but it seems pretty unlikely that it is a problem for the protractor team.


I am seeing this issue too, and installing Java via brew does not solve the issue for me.

> webdriver-manager start
selenium.pid: 5724
10:42:45.389 INFO - Launching a standalone Selenium Server
Setting system property webdriver.chrome.driver to /Users/alex/.node/lib/node_modules/webdriver-manager/selenium/chromedriver
10:42:45.431 INFO - Java: Oracle Corporation 25.66-b17
10:42:45.431 INFO - OS: Mac OS X 10.11.1 x86_64
10:42:45.444 INFO - v2.46.0, with Core v2.46.0. Built from revision 87c69e2
10:42:45.525 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC
10:42:45.525 INFO - Driver class not found: com.opera.core.systems.OperaDriver
10:42:45.526 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
10:42:45.609 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
10:42:45.610 INFO - Selenium Server is up and running

Then upon running the supplied bare-bones test above (i.e. opening chrome, navigating to google.com):

10:50:30.389 INFO - Executing: [new session: Capabilities [{browserName=chrome}]])
10:50:30.401 INFO - Creating a new session for Capabilities [{browserName=chrome}]
Starting ChromeDriver 2.19.346063 (38b35413bd4a486d436a9749e090454bc9ff6708) on port 8561
Only local connections are allowed.
10:50:51.185 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'asterix.local', ip: '10.58.9.23', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.1', java.version: '1.8.0_66'
Driver info: driver.version: unknown
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
    at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
    at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
    at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:125)
    at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:58)
    at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
    at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
    at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:175)
    at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:202)
    at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:164)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:130)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
    at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
    at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
    at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
    at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
    at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
    at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
    at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
    at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'asterix.local', ip: '10.58.9.23', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.1', java.version: '1.8.0_66'
Driver info: driver.version: unknown
    at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:113)
    at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:97)
    at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:103)
    ... 9 more
Caused by: org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'asterix.local', ip: '10.58.9.23', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.1', java.version: '1.8.0_66'
Driver info: driver.version: ChromeDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:589)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:141)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)
    ... 14 more
Caused by: java.lang.IllegalStateException: The process has not exited yet therefore no result is available ...
    at org.apache.commons.exec.DefaultExecuteResultHandler.getException(DefaultExecuteResultHandler.java:76)
    at org.openqa.selenium.os.UnixProcess.checkForError(UnixProcess.java:171)
    at org.openqa.selenium.os.CommandLine.checkForError(CommandLine.java:183)
    at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:169)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:63)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:568)
    ... 19 more
10:50:51.193 WARN - Exception: The process has not exited yet therefore no result is available ...

Unfortunately, not even downgrading to protractor v2.2 appears to solve this for me.

shopblocks commented 8 years ago

We had the same issue as this, and wrote this as a potential solution: http://stackoverflow.com/questions/34201990/unsupported-major-minor-version-on-mac-os-x-el-capitan

cmshah27 commented 8 years ago

I had the same issue and I was connected to my VPN network, issue resolved after I disconnected from VPN.

turtec commented 8 years ago

Thanks a lot! I had the same issue here. Updating java via brew fixes the problem

slylos commented 8 years ago

Just want to add brew also fixed the problem for me!

ghost commented 8 years ago

add directConnect: true to protractor.conf.js

pranav-ranjan commented 8 years ago

@canercak - Thank you, directConnect solved it for me

alexfradiani commented 8 years ago

As suggested in previous post,

brew update
brew cask install java

solved for me.

ralyodio commented 8 years ago

I get an error trying to upgrade javas with brew:

$ brew cask install java
Error: Cask 'java' definition is invalid: Bad header line: parse failed
elliottsj commented 8 years ago

@chovy Try brew uninstall --force brew-cask; brew update.

See also Homebrew-Cask README.md / https://github.com/caskroom/homebrew-cask/pull/15381

mqliutie commented 8 years ago

@elliottsj Really nice!!! Thanks

blingerson commented 8 years ago

Is it required that one needs to use brew to do the update specifically? If so, why?

qualityshepherd commented 8 years ago

@blingerson I don't use brew, so no. I just installed the latest JDK.

maverick09 commented 8 years ago

Following steps have resolved issue "Error: Another Selenium process is already running" for me as well, wasted last 2 hours trying to sort this out.

java -version

java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

Thanks a lot guys

planktonlex55 commented 7 years ago

Ditto error (like others before me). Is there a solution to fix this on windows? - plank

Mahesh-Taluja commented 7 years ago

@planktonlex55 ,did you get any solution for windows.? I am facing the similar issue on windows 7 OS (Java 1.8.0_111) while running parallel test using multiCapabilities and cannot use "directConnect: true" as my test include Internet explorer.

I am completely stuck due to this issue..

multiCapabilities: [ { 'browserName': 'chrome', shardTestFiles: true, maxInstances:3 },

   {
  'browserName': 'firefox',
   shardTestFiles: true,
   maxInstances:3
   },
   {
  'browserName': 'internet explorer',
  'platform':'ANY',
  'version':'8',          
   }

] , maxSessions: 3


holmes1310g commented 7 years ago

@canercak - Thank you, adding directConnect:true, to my protractor.conf.js file solved it for me, as well.

abhilashtc commented 7 years ago

Helloo,

I am trying to execute a TestNG script from Jenkins. Created a FreeStyle project from Jenkins from where a BAT file gets executed. The script fails with the following errrors, but it works fine when I execute it from Eclipse. From Jenkins it fails irrespective of the browser(Chrome or Firefox). The execution is failing when the WebDriver is created irrespective of the browser. Jenkins is at the latest version and selenium-server-standalone-3.4.0

C:\Program Files (x86)\Jenkins\workspace\TestNG_FB_Test>C:\TestNG_Bat\Test_FB.bat

C:\Program Files (x86)\Jenkins\workspace\TestNG_FB_Test>java -cp "C:\Drive 1\Eclipse_Workspace\TestNG\lib*";"C:\Drive 1\Eclipse_Workspace\TestNG\bin" org.testng.TestNG "C:\Drive 1\Eclipse_Workspace\TestNG\SuiteXMLs\testng.xml" [TestNG] Running: C:\Drive 1\Eclipse_Workspace\TestNG\SuiteXMLs\testng.xml

Invalid port. Exiting... ??? ??, ???? ??:??:?? ??????? org.openqa.selenium.os.UnixProcess checkForError SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) Closing the driver in @aftertest

Suite Total tests run: 1, Failures: 1, Skips: 0 Configuration Failures: 1, Skips: 1

I really appreciate if anybody has a work around or a fix for this issue.

Regards, Abhilash

anandgoudp commented 6 years ago

Am also getting same excepton when am running the selenium scripts using protractor in Ubuntu OS in firefox browser