Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uknown error when closing standalone selenium-webdriver on CI #2728

Closed
Crevil opened this issue Nov 20, 2015 · 10 comments
Closed

Uknown error when closing standalone selenium-webdriver on CI #2728

Crevil opened this issue Nov 20, 2015 · 10 comments

Comments

@Crevil
Copy link

Crevil commented Nov 20, 2015

Problem

When running Protractor on AppVeyor I get an error when closing the selenium webdriver.

C:\projects\appveyor-protractor-test-app\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108
  var template = new Error(this.message);
                 ^
UnknownError: Can't obtain updateLastError method for class com.sun.jna.Native
    at new bot.Error (C:\projects\appveyor-protractor-test-app\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108:18)
    at Object.bot.response.checkResponse (C:\projects\appveyor-protractor-test-app\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:109:9)
    at C:\projects\appveyor-protractor-test-app\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:379:20
    at [object Object].promise.Promise.goog.defineClass.invokeCallback_ (C:/projects/appveyor-protractor-test-app/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1337:14)
    at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_.execute_ (C:/projects/appveyor-protractor-test-app/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2776:14)
    at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_ (C:/projects/appveyor-protractor-test-app/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2758:21)
    at goog.async.run.processWorkQueue (C:\projects\appveyor-protractor-test-app\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:124:15)
    at process._tickCallback (node.js:368:9)
[launcher] Process exited with error code 1

The setup works on my local setup and protractor exits as expected.

Setup

Protractor handles the selenium server with the seleniumServerJar option in protractor.config.
On AppVeyor the projects is build and deployed on a local IIS server.
The tests run fine and the results is as expected.

Repository and build logs

See this repository with a minimalistic setup for complete setup and AppVeyor build for details on the run.

Here is a snippet of my local protractor log on the same build.

C:\Users\BSO\Documents\Git repos\AppVeyor-Protractor-test-app>node_modules\.bin\protractor
protractor.conf.js --troubleshoot
DEBUG - Running with --troubleshoot
DEBUG - Protractor version: 3.0.0
DEBUG - Your base url for tests is http://localhost:47602/
DEBUG - Attempting to find the chromedriver binary in the default location used
by webdriver-manager
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.5.153:42594/wd/hub
DEBUG - WebDriver session successfully started with capabilities Object {
  caps_:
   Object {
     applicationCacheEnabled: false,
     rotatable: false,
     mobileEmulationEnabled: false,
     chrome:
      Object {
        userDataDir: 'C:\\Users\\BSO\\AppData\\Local\\Temp\\scoped_dir7528_8065'
 },
     takesHeapSnapshot: true,
     databaseEnabled: false,
     handlesAlerts: true,
     hasTouchScreen: false,
     version: '46.0.2490.86',
     platform: 'WIN8_1',
     browserConnectionEnabled: false,
     nativeEvents: true,
     acceptSslCerts: true,
     'webdriver.remote.sessionid': '4a77a2b8-79ff-491f-8152-8595a2bd5a4a',
     locationContextEnabled: true,
     webStorageEnabled: true,
     browserName: 'chrome',
     takesScreenshot: true,
     javascriptEnabled: true,
     cssSelectorsEnabled: true } }
DEBUG - Running with spec files C:\Users\BSO\Documents\Git repos\AppVeyor-Protra
ctor-test-app\AppVeyor-Protractor-test-app\index.e2e.spec.js
Started
.
1 spec, 0 failures
Finished in 1.415 seconds
Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed
@NickTomlin
Copy link
Contributor

Thanks for creating a detailed example and explanation!

I'm not familiar with AppVeyor, but the fact that this works fine locally and some quick searching seems to point to an environmental issue, particularly with Java? I'd probably reach out to the AppVeyor folks and see if they can offer any assistance in debugging/configuring the build environment.

If it turns out to be an issue with the protractor internals we should definitely resume the conversation here. Thanks!

@FeodorFitsner
Copy link

Hi Nick,

AppVeyor developer is here. Thanks for looking into that. Can you give a hint what might be wrong with AppVeyor environment? Looks like that thread is related to Linux. I'm sure many customers would benefit from being able to run Protractor on AppVeyor environment!

@NickTomlin
Copy link
Contributor

@FeodorFitsner I won't be able to help much until later this evening, but i'd be happy to offer any assistance I can.

I totally blanked on the fact that AppVeyor is windows only. The problem should be (hopefully) similar enough though.

  1. What version of JNA is running on the AppVeyor boxes?
  2. If it's JNA < 4 that is probably the issue. If that works fantastic!
  3. If not, we should do some digging and probably coordinate in the gitter channel. I'll join in when my schedule frees up

You can use the example files to test this (i'll try to get an AppVeyor project set up later for testing).

@FeodorFitsner
Copy link

Thanks willing to help with that. No rush here.

I don't think we ever installed JNA explicitly on build workers. I thought it's something going along with Oracle's Java distributive, but looks like it's kind of a library: https://github.com/java-native-access/jna that should go with an app.

@NickTomlin
Copy link
Contributor

@FeodorFitsner @Crevil

I've been able to reproduce this with a smaller project without browserstack here. It looks like even though JNA is a dependency of selenium it will delegate to the system's version of JNA unless explicitly told not to (i'm not a Windows nor Java expert, so take that with a grain of salt). I haven't been able to find how to figure out which version of JNA is installed on these boxes but an older version that has tagged along with another package seems a likely culprit here.

I think this is more of a windows/selenium issue than a protractor one. I'm reaching a point of diminishing returns in terms of my expertise here but i'd be happy to continue to coordinate things if you want a second pair of eyes.

@FeodorFitsner
Copy link

Thanks for looking into that and the sample!

@NickTomlin
Copy link
Contributor

@sjelin I think we can close this? I'd like to work on getting AppVeyor tests running (so we can check windows in an automated way instead of having to boot up a VM) and I can follow up things on the AppVeyor side or open another more targeted issue.

@FeodorFitsner
Copy link

Yeah, thank you!

@sjelin sjelin closed this as completed Dec 12, 2015
@FeodorFitsner
Copy link

I've managed to fix the issue with JNA on AppVeyor.

To make it work configure -Djna.nosys=true option for Selenium process in protractor.conf.js:

    localSeleniumStandaloneOpts: {
        args: ['-Djna.nosys=true']
    },
    ...

Full protractor.conf.js reference:

localSeleniumStandaloneOpts: {
// The port to start the Selenium Server on, or null if the server should
// find its own unused port.
port: null,
// Additional command line options to pass to selenium. For example,
// if you need to change the browser timeout, use
// seleniumArgs: ['-browserTimeout=60']
args: []
},

@Crevil
Copy link
Author

Crevil commented Feb 10, 2016

Great news! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants