electron / chromedriver

Download ChromeDriver for Electron

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not able to use webdriver / protractor for electron app test automation

Jayasankar-m opened this issue · comments

An existing angularjs was converted as electron application by following the steps in the site.
The application is working fine and it is possible to navigate through the pages.
But not able to execute automation tests with 'protractor'.

**
1.Had downloaded 'electron-chromedriver' and launched the server.'electron-chromedriver' is listening on port 9515.

2.The conf.js file for protractor is given below
**

exports.config = {
    ...
    seleniumAddress:'http://localhost:9515/',
    capabilities: {
        browserName: 'electron',
        chromeOptions: {
            binary:"<path>\\node_modules\\.bin\\electron",
            args: [" <path>"]
        },
    ...
    }
};

Following error is obtained on executing the tests.

Debugger listening on ws://127.0.0.1:26008/a0465e09-2522-4ccc-ad0e-6423002c1b8e

(node:6456) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[13:50:44] I/launcher - Running 1 instances of WebDriver
[13:50:44] I/hosted - Using the selenium server at http://localhost:9515/
[13:50:44] E/runner - Unable to start a WebDriver session.
(node:6456) UnhandledPromiseRejectionWarning: WebDriverError: unknown error: Failed to create a Chrome process.
  (Driver info: chromedriver=76.0.3783.1 (e74cdb57d7c7a6c37e9b21d8557e53bbdba17e42-refs/branch-heads/3783@{#2}),platform=Windows NT 10.0.15063 x86_64)
    at Object.checkLegacyResponse (<path>\node_modules\selenium-webdriver\lib\error.js:546:15)
    at parseHttpResponse (<path>\node_modules\selenium-webdriver\lib\http.js:509:13)
    at doSend.then.response (<path>\node_modules\selenium-webdriver\lib\http.js:441:30)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
(node:6456) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6456) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[13:50:44] E/launcher - Error: WebDriverError: unknown error: Failed to create a Chrome process.
  (Driver info: chromedriver=76.0.3783.1 (e74cdb57d7c7a6c37e9b21d8557e53bbdba17e42-refs/branch-heads/3783@{#2}),platform=Windows NT 10.0.15063 x86_64)
    at Object.checkLegacyResponse (<path>\node_modules\selenium-webdriver\lib\error.js:546:15)
    at parseHttpResponse (<path>\node_modules\selenium-webdriver\lib\http.js:509:13)
    at doSend.then.response (<path>\node_modules\selenium-webdriver\lib\http.js:441:30)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
[13:50:44] E/launcher - Process exited with error code 100

Thanks in Advance!!

+1

With this config

capabilities: { 'browserName': 'chrome', chromeOptions: { binary: './node_modules/.bin/electron', args: ['app=./main.js'] } }
Following error is obtained on executing the tests.

[10:59:03] E/launcher - unknown error: Failed to create a Chrome process. (Driver info: chromedriver=77.0.3865.10 (bc3579f611bbc73331171afe020ec7a45e6ccc55-refs/branch-heads/3865@{#93}),platform=Windows NT 10.0.18362 x86_64) [10:59:03] E/launcher - WebDriverError: unknown error: Failed to create a Chrome process. (Driver info: chromedriver=77.0.3865.10 (bc3579f611bbc73331171afe020ec7a45e6ccc55-refs/branch-heads/3865@{#93}),platform=Windows NT 10.0.18362 x86_64) at Object.checkLegacyResponse (C:\Users\coder\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:546:15) at parseHttpResponse (C:\Users\coder\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:509:13) at doSend.then.response (C:\Users\coder\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:441:30) at process._tickCallback (internal/process/next_tick.js:68:7) From: Task: WebDriver.createSession() at Function.createSession (C:\Users\coder\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:769:24) at Function.createSession (C:\Users\coder\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\chrome.js:761:15) at Direct.getNewDriver (C:\Users\coder\AppData\Roaming\npm\node_modules\protractor\built\driverProviders\direct.js:77:33) at Runner.createBrowser (C:\Users\coder\AppData\Roaming\npm\node_modules\protractor\built\runner.js:195:43) at q.then.then (C:\Users\coder\AppData\Roaming\npm\node_modules\protractor\built\runner.js:339:29) at _fulfilled (C:\Users\coder\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:834:54) at C:\Users\coder\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:863:30 at Promise.promise.promiseDispatch (C:\Users\coder\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:796:13) at C:\Users\coder\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:556:49 at runSingle (C:\Users\coder\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:137:13) [10:59:03] E/launcher - Process exited with error code 199

Try defining the remote-debugging-port to 9515 as a chrome option.