使用量角器Internet Explorer出现错误

时间:2019-03-22 20:39:21

标签: internet-explorer protractor config explorer

我一直在尝试使量角器在我的Internet Explorer代码上工作时遇到问题。我有chrome测试,它适用于那些测试,但是当我在IE上运行它时,我得到一个错误代码135,并且错误消息:ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444。这是我下面的配置文件。

我尝试更新我的npm内容,添加“ seleniumArgs”代码行,然后

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './e2e/**/*.e2e-spec.ts',
   // './IESpec.ts'
  ],
  seleniumAddress: 'http://localhost:4444/wd/hub',
  seleniumArgs: ['-Dwebdriver.edge.driver=your/path/to/MicrosoftWebDriver.exe'],
  // capabilities: {
  //   'browserName': 'chrome',
  //   //'browserName': 'internet explorer',
  //   'sharedTestFiles': true,
  //   'maxInstances': 1,
  //   'chromeOptions': {
  //     'args': ['--no-sandbox', '--disable-dev-shm-usage']
  //     // 'args': ['incognito'],
  //     // 'args': [ "--headless", "--disable-gpu"]
  //   }
  capabilities: { 
    'browserName': 'internet explorer', 
    'ignoreProtectedModeSettings': true, 
    'platform': 'ANY', 
    'version': '11', 
    args: ['--silent', '--no-sandbox', '--test-type=browser', '--lang=US', '--start-maximized'], //,'--headless', '--disable-gpu' 
    prefs: { 
        'download': {
            'prompt_for_download': false, 
            'directory_upgrade': true, 
            'extensions_to_open': '', 
            'default_directory': process.cwd() + '/downloads/'
        }, 
    } 
}, 
localSeleniumStandaloneOpts: { 
    jvmArgs: [ 
        '-Dwebdriver.ie.driver=node_modules/protractor/node_modules/webdriver-manager/selenium/IEDriverServer3.14.0.exe'
    ] 
}, 
directConnect: false, 
framework: 'jasmine', 
seleniumArgs: ['-Dwebdriver.ie.driver=node_modules/protractor/node_modules/webdriver-manager/selenium/IEDriverServer3.14.0.exe'], 
seleniumAddress: 'http://localhost:4444/wd/hub',
  params: {
    login: {
      user: 'User',
      password: 'password'
    },
    url: {
      site: //'https://URL'
      'https://URL'
    }
  },
  directConnect: false,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 40000,
    print: function () { }
  },
  beforeLaunch: function () {
    return new Promise(function (resolve) {
      reporter.beforeLaunch(resolve);
    });
  },
  onPrepare() {
    browser.driver.manage().window().maximize();
    jasmine.getEnv().addReporter(reporter);
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  },
  suites: {
    smoke: './e2e/smoke/*.ts',
  },
  afterLaunch: function (exitCode) {
    return new Promise(function (resolve) {
      reporter.afterLaunch(resolve.bind(this, exitCode));
    });
  }
};

This is the error message i get at the bottom

Report destination:   reports\Screenshots\report.html
[15:26:09] I/launcher - Running 1 instances of WebDriver
[15:26:09] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[15:26:10] E/launcher - Error code: 135
[15:26:10] E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
[15:26:10] E/launcher - Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444

1 个答案:

答案 0 :(得分:1)

我通过添加jvmArgs使其工作:[“ -Dwebdriver.ie.driver = node_modules / protractor / node_modules / webdriver-manager / selenium / IEDriverServer3.141.5.exe”]我不确定这有什么帮助,但至少开始启动IE