Reputation: 303
Background: I'm currently trying to implement the basic WebdriverIO example from inside an Angular Electron App. My App is based on the Angular Electron Boilerplate. I have installed webdriverio and @types/webdriverio via npm. Then I created the following service:
import { Injectable } from '@angular/core';
import { remote, Options } from 'webdriverio';
@Injectable()
export class WebdriverioService {
remote: typeof remote;
options: Options;
constructor() {
this.options = {
desiredCapabilities: {
browserName: 'chrome'
}
}
}
test(): void {
remote(this.options) // <-- this line causes the error
.init()
.url('http://www.google.com')
.getTitle().then(function (title) {
console.log('Title was: ' + title);
})
.end()
.catch(function (err) {
console.log(err);
});
}
}
I have marked the critical line with a comment. Firstly I get the following compiler warnings:
WARNING in ./node_modules/webdriverio/build/lib/launcher.js
138:39-55 Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/webdriverio/build/lib/utils/ConfigParser.js
144:58-75 Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/webdriverio/build/lib/helpers/getImplementedCommands.js
59:44-90 Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/webdriverio/build/lib/launcher.js
812:34-50 Critical dependency: the request of a dependency is an expression
Secondly my App throws the following error:
Uncaught Error: ENOENT, protocol not found in <<Path to App>>\node_modules\electron\dist\resources\electron.asar
at notFoundError (ELECTRON_ASAR.js:114)
at Object.fs.readdirSync (ELECTRON_ASAR.js:588)
at getImplementedCommands (getImplementedCommands.js:40)
at Object../node_modules/webdriverio/build/index.js (index.js:59)
at __webpack_require__ (bootstrap:76)
at Object../src/app/providers/webdriverio.service.ts (electron.service.ts:10)
at __webpack_require__ (bootstrap:76)
at Object../src/app/app.module.ts (app.component.ts:11)
at __webpack_require__ (bootstrap:76)
at Object../src/main.ts (environment.ts:4)
I think this issue seems to be mostly typescript configuration related, but I'm not shure. I don't really know where to look at. Could someone maybe tell me what I forgot?
Upvotes: 0
Views: 599
Reputation: 2269
I don't know the specific answer to this, but I am working on a similar idea.
I haven't figured out how to resolve the "the request of a dependency is an expression" issue, but I do know that it doesn't seem to be interfering right now. You could probably ignore that issue.
Electron with asar has been a bit confusing for me as well. Maybe having a look through the repo code I linked above will help out. I know that it has helped me a ton to look through various electron repos out there.
Upvotes: 1