在量角器测试中启动Internet Explorer会话时遇到问题

时间:2019-03-26 15:19:57

标签: selenium internet-explorer protractor config

我正在尝试在Internet Explorer上启动自动化测试,但是它们无法正常工作。在我的控制台中,听起来硒运行正常,但是无法创建会话。

[09:32:10] I/launcher - Running 1 instances of WebDriver
[09:32:10] I/local - Starting selenium standalone server...
[09:32:11] I/local - Selenium standalone server started at http://10.30.2.118:60727/wd/hub
[09:32:15] E/launcher - Unable to create session from {
"desiredCapabilities": {
    "count": 1,
    "browserName": "internet explorer",
    "version": "11",
    "platform": "ANY"
  },
  "capabilities": {
    "firstMatch": [
      {
        "browserName": "internet explorer"
      }
    ]
  }
}

我确保在IE中未选中所有保护模式的安全设置。 我所有的驱动程序都是最新的

//protractor.conf 
exports.config = {
  allScriptsTimeout: 11000,
  capabilities: {
    //  'seleniumAddress': 'http://localhost:4444/wd/hub',
    'browserName': 'internet explorer',
    'platform': 'ANY',
    'version': '11'
  },
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  params: {
    login: {
      user: 'user123',
      password: 'Pass123'
    },
    url: {
      site: 'https://website.com'
    }
  },
  //directConnect: true,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 40000,
    print: function () { }
  },

运行代码时,我期望IE能够启动。 Chrome可以正常工作。

1 个答案:

答案 0 :(得分:0)

要解决此问题,您必须做两件事:

  1. 您将需要在目标计算机上设置一个注册表项,以便驱动程序可以维持与其创建的Internet Explorer实例的连接。
  2. 更改该计算机(您希望在其中运行自动化的位置)上Internet Explorer浏览器的一些设置。

设置注册表项/条目:

  • 要设置注册表项或条目,您需要打开“注册表编辑器”。
  • 要打开“注册表编辑器”,请按Windows按钮+ r字母键,这将打开“运行窗口”,然后键入“ regedit”并按Enter。
  • 或按Windows按钮,然后在开始菜单中输入“ regedit”,然后按Enter。
  • 现在根据您的操作系统类型,是否按照相应的步骤执行32/64位操作。
  • Windows 32位:转到此位置-“ HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Internet Explorer \ Main \ FeatureControl”,然后检查“ FEATURE_BFCACHE”键。
  • Windows 64位:转到此位置-HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ Microsoft \ Internet Explorer \ Main \ FeatureControl,然后检查“ FEATURE_BFCACHE”键。
  • 请注意,FEATURE_BFCACHE子项可能存在也可能不存在,如果不存在,则应创建该子项。
  • 重要提示:在此注册表项内,创建一个名为iexplore.exe的DWORD值,其值为0。

enter image description here

更改Internet Explorer浏览器的设置:

  • 单击设置按钮,然后选择“ Internet选项”。
  • 在“ Internet选项”窗口上,转到“安全”标签
  • 现在选择“ Internet”选项,然后取消选中“启用保护模式”复选框,然后将“安全级别”更改为低。
  • 现在选择“本地Intranet”选项,并将“安全级别”更改为低。
  • 现在选择“受信任的站点”选项,并将“安全级别”更改为低。 No alt text provided for this image
  • 现在单击“应用”按钮,可能会弹出警告,单击“确定”按钮进行警告,然后单击“ Internet选项”窗口上的“确定”按钮。 No alt text provided for this image
  • 重新启动浏览器后。