【问题标题】:Trying to include WebdriverIO into Angular Electron App尝试将 WebdriverIO 包含到 Angular Electron 应用程序中
【发布时间】:2018-07-31 15:12:58
【问题描述】:

背景:我目前正在尝试从 Angular Electron 应用程序内部实现基本的WebdriverIO example。我的应用程序基于Angular Electron Boilerplate。我已经通过 npm 安装了 webdriverio@types/webdriverio。然后我创建了以下服务:

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);
            });
    }
}

我已用评论标记了关键行。首先,我收到以下编译器警告:

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

其次我的应用程序抛出以下错误:

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)

我认为这个问题似乎主要与 typescript 配置有关,但我不放心。我真的不知道在哪里看。有人能告诉我我忘记了什么吗?

【问题讨论】:

    标签: angular typescript electron webdriver-io


    【解决方案1】:

    我不知道具体的答案,但我正在处理a similar idea

    我还没有弄清楚如何解决“依赖项的请求是一个表达式”的问题,但我知道它现在似乎没有受到干扰。你可能会忽略这个问题。

    Electron with asar 也让我有些困惑。也许看看我上面链接的回购代码会有所帮助。我知道它对我浏览各种电子回购有很大帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-09
      • 2018-10-05
      • 2017-10-20
      • 2015-03-17
      • 2016-08-26
      • 1970-01-01
      • 2011-10-08
      • 2023-04-03
      相关资源
      最近更新 更多