量角器测试用户不会在Firefox上运行

时间:2016-01-06 18:24:34

标签: javascript firefox selenium protractor

我正在尝试使用Firefox运行一些量角器测试用例,但每次尝试都失败了。我可以使用Chrome运行相同的测试用例没问题。我尝试以两种方式运行这些测试:

1)在命令提示符下启动webdriver:

webdriver-manager start

2)不以这种方式启动webdriver并将以下行添加到conf.js文件中:

directConnect: true;

当我尝试以第一种方式运行测试用例时失败并显示以下消息:

"C:\Program Files (x86)\JetBrains\WebStorm 11.0.3\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\lib\cli.js conf.js
Using the selenium server at http://127.0.0.1:4444/wd/hub
[launcher] Running 1 instances of WebDriver

c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108
  var template = new Error(this.message);
                 ^
UnknownError: Unable to connect to host 127.0.0.1 on port 7056 after 45000 ms. Firefox console output:
84}","minVersion":"21.0","maxVersion":"25.0a1"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":2}
1452102740148   addons.xpi  DEBUG   getModTime: Recursive scan of {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}
1452102740148   addons.xpi  DEBUG   Updating XPIState for {"id":"{972ce4c6-7e08-4474-a285-3208198ce6fd}","syncGUID":"UpuHktvyU6P2","location":"app-global","version":"43.0.2","type":"theme","internalName":"classic/1.0","updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Default","description":"The default theme.","creator":"Mozilla","homepageURL":null,"contributors":["Mozilla Contributors"]},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}","installDate":1452101386609,"updateDate":1452101386609,"applyBackgroundUpdates":1,"skinnable":true,"size":24172,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"43.0.2","maxVersion":"43.0.2"}],"targetPlatforms":[]}
1452102740148   addons.xpi  DEBUG   getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1452102740149   DeferredSave.extensions.json    DEBUG   Save changes
1452102740149   addons.xpi  DEBUG   Updating database with changes to installed add-ons
1452102740149   addons.xpi-utils    DEBUG   Updating add-on states
1452102740150   addons.xpi-utils    DEBUG   Writing add-ons list
1452102740154   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}.xpi
1452102740154   addons.xpi  DEBUG   Calling bootstrap method startup on {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A} version 7.5.0.9082
1452102740179   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1452102740179   addons.manager  DEBUG   Provider finished startup: XPIProvider
1452102740179   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1452102740179   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1452102740179   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1452102740179   addons.manager  DEBUG   Starting provider: GMPProvider
1452102740183   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1452102740183   addons.manager  DEBUG   Provider finished startup: GMPProvider
1452102740183   addons.manager  DEBUG   Starting provider: PluginProvider
1452102740183   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1452102740183   addons.manager  DEBUG   Provider finished startup: PluginProvider
1452102740183   addons.manager  DEBUG   Completed startup sequence
1452102740391   addons.manager  DEBUG   Starting provider: <unnamed-provider>
1452102740391   addons.manager  DEBUG   Registering shutdown blocker for <unnamed-provider>
1452102740391   addons.manager  DEBUG   Provider finished startup: <unnamed-provider>
1452102740489   DeferredSave.extensions.json    DEBUG   Starting write
1452102740645   addons.repository   DEBUG   No addons.json found.
1452102740645   DeferredSave.addons.json    DEBUG   Save changes
1452102740647   DeferredSave.addons.json    DEBUG   Starting timer
1452102740656   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1452102740656   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1452102740656   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1452102740657   DeferredSave.extensions.json    DEBUG   Write succeeded
1452102740657   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 17
1452102740814   DeferredSave.addons.json    DEBUG   Starting write
1452102740958   DeferredSave.addons.json    DEBUG   Write succeeded
JavaScript error: resource://skype_ff_extension-at-jetpack/skype_ff_extension/data/c2c_options_menu_localization.js, line 189: TypeError: document.getElementById(...) is null

    at new bot.Error (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108:18)
    at Object.bot.response.checkResponse (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:109:9)
    at c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:160:24
    at [object Object].promise.Promise.goog.defineClass.invokeCallback_ (c:/Users/daobrien15/AppData/Roaming/npm/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:/Users/daobrien15/AppData/Roaming/npm/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:/Users/daobrien15/AppData/Roaming/npm/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2758:21)
    at goog.async.run.processWorkQueue (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:124:15)
    at process._tickCallback (node.js:382:9)
From: Task: WebDriver.createSession()
    at Function.webdriver.WebDriver.acquireSession_ (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:157:22)
    at Function.webdriver.WebDriver.createSession (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:131:30)
    at [object Object].Builder.build (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\builder.js:445:22)
    at [object Object].DriverProvider.getNewDriver (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\driverProvider.js:38:7)
    at [object Object].Runner.createBrowser (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:186:37)
    at c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:276:21
    at _fulfilled (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:797:54)
    at self.promiseDispatch.done (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:826:30)
    at Promise.promise.promiseDispatch (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:759:13)
    at c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:525:49
[launcher] Process exited with error code 1

Process finished with exit code 1

它还加载了'firstrun&#39;打开firefox时的页面。我不确定这是否相关,但我想包含它以防万一,因为当它使用&#39; directConnect:true&#39;它会显示一个新标签页。

当我运行第二种方式时(即在conf.js中使用directConnect:true),我收到以下错误:

"C:\Program Files (x86)\JetBrains\WebStorm 11.0.3\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\lib\cli.js conf.js
Using FirefoxDriver directly...
[launcher] Running 1 instances of WebDriver
[launcher] Process exited with error code 1

c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\util.js:89
          Error('Timed out waiting for the WebDriver server at ' + url));
          ^
Error: Timed out waiting for the WebDriver server at http://127.0.0.1:63951/hub
    at Error (native)
    at onResponse (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\util.js:89:11)
    at c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\util.js:44:21
    at c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\http\http.js:140:5
    at ClientRequest.<anonymous> (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:174:7)
    at emitOne (events.js:77:13)
    at ClientRequest.emit (events.js:169:7)
    at Socket.socketErrorListener (_http_client.js:265:9)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
From: Task: WebDriver.createSession()
    at Function.webdriver.WebDriver.acquireSession_ (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:157:22)
    at Function.webdriver.WebDriver.createSession (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:131:30)
    at new Driver (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\firefox\index.js:278:36)
    at [object Object].DirectDriverProvider.getNewDriver (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\direct.js:75:16)
    at [object Object].Runner.createBrowser (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:186:37)
    at c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:276:21
    at _fulfilled (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:797:54)
    at self.promiseDispatch.done (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:826:30)
    at Promise.promise.promiseDispatch (c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:759:13)
    at c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:525:49

Process finished with exit code 1

我将量角器更新到3.0版,然后将我的webdriver更新为2.48.2。我目前正在使用firefox 43.0.2,但我也尝试降级到41,我仍然遇到同样的问题。

我的conf.js文件如下:

exports.config = {
    seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
    baseUrl: "http://XXX:8080/",
    specs: ['specs/demandFeatureSpec.js'],

    capabilities: {
        'browserName': 'firefox'
    },

    directConnect: true,

    framework: 'jasmine2',

    onPrepare: function() {
        var jasmineReporters = require('jasmine-reporters');
        jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
            consolidateAll: true,
            savePath: 'testresults',
            filePrefix: 'xmloutput'
        }));

        browser.driver.manage().window().maximize();
        browser.driver.get(browser.baseUrl);

        global.isAngularSite = function(flag){
            browser.ignoreSynchronization = !flag;
        };

        global.getRandomInt = function(min, max) {
            var randomNum = Math.floor(Math.random() * (max - min + 1)) + min;
            return randomNum.toString();
        };
    },

    params: {
        login: {
            username: 'XXX',
            password: 'XXX'
        }
    }

};

顺便说一下,我使用的IDE是WebStorm 11。 对此的任何帮助将不胜感激。

谢谢, 丹

1 个答案:

答案 0 :(得分:0)

我安装了Firefox 35版本,这似乎适用于我当前的配置