无法用firefox启动量角器

时间:2016-08-04 14:25:35

标签: firefox webdriver protractor

当我启动量角器时,firefox打开,但我的测试没有执行。过了一会儿,我抽出时间错误。你能帮我解决问题吗? (与铬一起使用)。

操作系统:Windows 8.1 x64

量角器 - 版本 版本4.0.2

firefox版本48.0

protractor.config.js:

exports.config = {
    directConnect: true,
    seleniumAddress: 'http://localhost:4444/wd/hub',
    specs: ['*.spec.js'],
    baseUrl: 'http://localhost:9876',
    capabilities: {
        'browserName': 'firefox'
    }
};

首先我开始使用webdriver:

>webdriver-manager start

然后在其他cmd中,我运行量角器:

>protractor protractor.conf.js

输出:

X:\e2e>protractor protractor.conf.js
[15:38:25] I/direct - Using FirefoxDriver directly...
[15:38:25] I/launcher - Running 1 instances of WebDriver
[15:39:11] E/launcher - Timed out waiting for the WebDriver server at http://127
.0.0.1:55485/hub
[15:39:11] E/launcher - Error: Timed out waiting for the WebDriver server at htt
p://127.0.0.1:55485/hub
    at Error (native)
    at onError (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_
modules\selenium-webdriver\http\util.js:87:11)
    at ManagedPromise.invokeCallback_ (C:\Users\<USER>\AppData\Roaming\npm\node_m
odules\protractor\node_modules\selenium-webdriver\lib\promise.js:1379:14)
    at TaskQueue.execute_ (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protr
actor\node_modules\selenium-webdriver\lib\promise.js:2913:14)
    at TaskQueue.executeNext_ (C:\Users\<USER>\AppData\Roaming\npm\node_modules\p
rotractor\node_modules\selenium-webdriver\lib\promise.js:2896:21)
    at C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_modules\s
elenium-webdriver\lib\promise.js:2775:27
    at C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_modules\s
elenium-webdriver\lib\promise.js:639:7
    at process._tickCallback (node.js:369:9)
From: Task: WebDriver.createSession()
    at Function.createSession (C:\Users\<USER>\AppData\Roaming\npm\node_modules\p
rotractor\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
    at Driver (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_m
odules\selenium-webdriver\firefox\index.js:386:38)
    at Direct.getNewDriver (C:\Users\<USER>\AppData\Roaming\npm\node_modules\prot
ractor\built\driverProviders\direct.js:75:26)
    at Runner.createBrowser (C:\Users\<USER>\AppData\Roaming\npm\node_modules\pro
tractor\built\runner.js:187:43)
    at C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\built\runner.j
s:261:30
    at _fulfilled (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\no
de_modules\q\q.js:834:54)
    at self.promiseDispatch.done (C:\Users\<USER>\AppData\Roaming\npm\node_module
s\protractor\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (C:\Users\<USER>\AppData\Roaming\npm\node_
modules\protractor\node_modules\q\q.js:796:13)
    at C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_modules\q
\q.js:556:49
    at runSingle (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\nod
e_modules\q\q.js:137:13)
[15:39:11] E/launcher - Process exited with error code 199

2 个答案:

答案 0 :(得分:1)

最新版本的量角器尚不支持Firefox 48,请将你的firefox降级为 47.0.1 并尝试它肯定会有效!

答案 1 :(得分:0)

安装最新版本的Firefox和量角器。 如果已在程序文件中安装了Firefox,请以管理员方式打开命令行,以避免潜在的访问错误。

在conf.js中使用以下功能

async ngOnInit() {

    await this.cacheDropdownOptions();


    this.nationalities = JSON.parse(localStorage.getItem('nationality'));
    this.titles = JSON.parse(localStorage.getItem('titles'));
    this.idDocumentTypes = JSON.parse(localStorage.getItem('identityTypes'));
    this.genders = JSON.parse(localStorage.getItem('genders'));
  }

  async cacheDropdownOptions() {
    .. use subscription
  }
}