量角器浏览器但未连接到测试网址

时间:2016-11-09 05:29:43

标签: node.js protractor

我有Windows 10笔记本电脑。我的问题是,在我运行conf.js文件后,浏览器正在打开,但没有连接到测试网址。给出以下错误信息。

   C:\Users\acer\AppData\Roaming\npm\node_modules\protractor\FFAutomation>C:\Users\acer\AppData\Roaming\npm\protractor conf.js
    Report destination:   target\screenshots\Report.html
    [15:59:26] I/direct - Using FirefoxDriver directly...
    [15:59:26] I/launcher - Running 1 instances of WebDriver
    [16:00:15] E/launcher - Timed out waiting for the WebDriver server at http://127.0.0.1:55402/hub
    [16:00:15] E/launcher - Error: Timed out waiting for the WebDriver server at http://127.0.0.1:55402/hubat Error (native)

    And lastly [16:00:15] E/launcher - Process exited with error code 199
enter code here

conf.js文件如下:            var HtmlScreenshotReporter = require(' protractor-jasmine2-screenshot-reporter');

    var reporter = new HtmlScreenshotReporter({
    dest: 'target/screenshots',
    filename: 'Report.html',
    reportTitle: 'Execution Report',
    showSummary: true,
    showQuickLinks: true,

    pathBuilder: function(currentSpec, suites, browserCapabilities) {
      // will return chrome/your-spec-name.png
    return browserCapabilities.get('browserName') + '/' + currentSpec.fullName;
   }
});

exports.config = {

    directConnect: true,
    //seleniumAddress: 'http://localhost:4444/wd/hub',
    capabilities: {'browserName': 'firefox'},
    // multiCapabilities: [
    // {
    //     browserName: 'firefox'
    //   }, 
    //   {
    //     browserName: 'chrome'
    //   }
    //   ],

    framework: 'jasmine',
    specs: ['Login_spec3.js'],
    //'Login_spec2.js','Article_spec.js','Catalog_spec.js',            '     'LoginwithTD_spec2.js', 'Login_spec3copy.js','Setting_spec.js'
    allScriptsTimeout: 300000,
    getPageTimeout: 300000,
    jasmineNodeOpts: {
       defaultTimeoutInterval: 300000
    },

    // Setup the report before any tests start
    beforeLaunch: function() {
    return new Promise(function(resolve){
        reporter.beforeLaunch(resolve);
      });
   },
   // Close the report after all tests finish
   afterLaunch: function(exitCode) {
      return new Promise(function(resolve){
       reporter.afterLaunch(resolve.bind(this, exitCode));
      });
   },

    onPrepare: function() {
        var width = 1300;
        var height = 1200;
        browser.driver.manage().window().setSize(width,height);
        jasmine.getEnv().addReporter(reporter);
        afterAll(function(done) {
            process.nextTick(done);
        })
        //browser.params.users  = require('./shared.params.' + countryCode +    '.json').users;
    }

};

*I have copied some scripts(which is executable on her macbook) from a   friend and paste it in a folderin window 10 pc named FFAutomation path.             C:\Users\acer\AppData\Roaming\npm\node_modules\protractor\FFAutomation

1)I have update the chrome driver to version 2.24 chromedriver_win32 ,   update the chrome driver with command "webdriver-manager update" and run the webdriver with command "webdriver-manager start".
2) Than i run conf.js file on another terminal with the firefox browser 
 C:\Users\acer\AppData\Roaming\npm\node_modules\protractor\FFAutomation>C:\Users\    acer\AppData\Roaming\npm\protractor conf.js
I am getting this following error
Report destination:   target\screenshots\Report.html
    [15:59:26] I/direct - Using FirefoxDriver directly...
    [15:59:26] I/launcher - Running 1 instances of WebDriver
    [16:00:15] E/launcher - Timed out waiting for the WebDriver server at   http://127.0.0.1:55402/hub
    [16:00:15] E/launcher - Error: Timed out waiting for the WebDriver server at http://127.0.0.1:55402/hubat Error (native)

    And lastly [16:00:15] E/launcher - Process exited with error code 199
    enter code here
    3) Than i run conf.js file on another terminal with the "chrome" browser 
 C:\Users\acer\AppData\Roaming\npm\node_modules\protractor\FFAutomation>C:\Users\         acer\AppData\Roaming\npm\protractor conf.js
    I am getting this following error
    Error: Error: Cannot find module '/Users/rohitgathibandhe/npm-  global/lib/node_modules/protractor/FFAutomation/Function_Lib.js'
    E/launcher - Process exited with error code 100

1 个答案:

答案 0 :(得分:0)

在执行测试之前运行webdriver-manager start