Windows 10 上带有 IE 的量角器失败 - 错误代码 199 [英] Protractor with IE on Windows 10 fails - error code 199

查看:31
本文介绍了Windows 10 上带有 IE 的量角器失败 - 错误代码 199的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法让量角器在 Windows 10 上使用 IE 11.它说 Unable to create new service: InternetExplorerDriverService 并且存在代码 199

I can't get protractor to work with IE 11 on Windows 10. It says Unable to create new service: InternetExplorerDriverService and exists with code 199

我已经尝试过旧的重新安装/升级节点、npm、量角器、webdriver-manager 和爪哇;它似乎没有任何区别.

I have tried the age old reinstalled/upgraded node, npm, protractor, webdriver-manager & java; and it didn't seem to make any difference.

量角器在 Chrome 上运行良好;并且在配置中使用 Chrome 不会影响 IE.

Protractor works fine with Chrome; and having Chrome in the config does not affect IE.

我的配置文件:

// protractor.conf.js
exports.config = {
    framework: 'jasmine',
    specs: [
        'protractor/specs/**/*.js'
    ],
    multiCapabilities: [
        {
            browserName: 'internet explorer',
            version: 11,
            'ignoreProtectedModeSettings': true
        }
    ]
};

软件版本:

node --version
v8.9.4

npm --version
5.7.1

protractor --version
Version 5.3.0

java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

webdriver-manager status
[15:36:53] I/status - selenium standalone version available: 3.9.1 [last]
[15:36:53] I/status - chromedriver version available: 2.35 [last]
[15:36:53] I/status - geckodriver version available: v0.19.1 [last]
[15:36:53] I/status - IEDriverServer version available: 3.9.0 [last]
[15:36:53] I/status - android-sdk is not present
[15:36:53] I/status - appium is not present

完全错误

protractor ./tests/protractor.conf.js

(node:13724) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[15:37:44] I/launcher - Running 1 instances of WebDriver
[15:37:44] I/local - Starting selenium standalone server...
[15:37:53] I/local - Selenium standalone server started at http://10.1.0.213:52331/wd/hub
[15:37:53] E/launcher - Unable to create new service: InternetExplorerDriverService
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:28.403Z'
System info: host: 'my.hostname', ip: '10.1.0.213', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161'
Driver info: driver.version: unknown
[15:37:53] E/launcher - SessionNotCreatedError: Unable to create new service: InternetExplorerDriverService
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:28.403Z'
System info: host: 'my.hostname', ip: '10.1.0.213', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161'
Driver info: driver.version: unknown
    at Object.checkLegacyResponse (C:Usersmy.usernameAppDataRoaming
pm
ode_modulesprotractor
ode_modulesselenium-webdriverliberror.js:546:15)
    at parseHttpResponse (C:Usersmy.usernameAppDataRoaming
pm
ode_modulesprotractor
ode_modulesselenium-webdriverlibhttp.js:509:13)
    at doSend.then.response (C:Usersmy.usernameAppDataRoaming
pm
ode_modulesprotractor
ode_modulesselenium-webdriverlibhttp.js:441:30)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
    at Function.createSession (C:Usersmy.usernameAppDataRoaming
pm
ode_modulesprotractor
ode_modulesselenium-webdriverlibwebdriver.js:769:24)
    at createDriver (C:Usersmy.usernameAppDataRoaming
pm
ode_modulesprotractor
ode_modulesselenium-webdriverindex.js:170:33)
    at Builder.build (C:Usersmy.usernameAppDataRoaming
pm
ode_modulesprotractor
ode_modulesselenium-webdriverindex.js:635:14)
    at Local.getNewDriver (C:Usersmy.usernameAppDataRoaming
pm
ode_modulesprotractoruiltdriverProvidersdriverProvider.js:53:33)
    at Runner.createBrowser (C:Usersmy.usernameAppDataRoaming
pm
ode_modulesprotractoruilt
unner.js:195:43)
    at q.then.then (C:Usersmy.usernameAppDataRoaming
pm
ode_modulesprotractoruilt
unner.js:339:29)
    at _fulfilled (C:Usersmy.usernameAppDataRoaming
pm
ode_modulesprotractor
ode_modulesqq.js:834:54)
    at self.promiseDispatch.done (C:Usersmy.usernameAppDataRoaming
pm
ode_modulesprotractor
ode_modulesqq.js:863:30)
    at Promise.promise.promiseDispatch (C:Usersmy.usernameAppDataRoaming
pm
ode_modulesprotractor
ode_modulesqq.js:796:13)
    at C:Usersmy.usernameAppDataRoaming
pm
ode_modulesprotractor
ode_modulesqq.js:604:44
[15:37:53] E/launcher - Process exited with error code 199

手动运行 InternetExplorerDriverService 会打开一个窗口,上面写着

Running InternetExplorerDriverService manually opens a window which says

Started InternetExplorerDriver server (32-bit)
3.9.0.0
Listening on port 5555
Only local connections are allowed

但这不会改变结果.

推荐答案

为我做的主要事情是重命名下载的文件!npm/selenium 下载 C:Usersmy.usernameAppDataRoaming pm ode_modulesprotractor ode_moduleswebdriver-managerseleniumIEDriverServer3.9.0.exe 绝望我删除了版本,将其重命名为 IEDriverServer.exe 在同一文件夹中;这样就成功了.

The main thing that did it for me was renaming the downloaded file! npm/selenium downloaded C:Usersmy.usernameAppDataRoaming pm ode_modulesprotractor ode_moduleswebdriver-managerseleniumIEDriverServer3.9.0.exe out of desperation I removed the version, renaming it to IEDriverServer.exe in the same folder; and that did the trick.

由于这个项目的环境性质,我还需要让安全团队允许它运行;这可能并不适用于所有人.

I also needed to get the security team to allow it to run, because of the nature of the environment for this project; this might not apply to everyone.

还有一个我在 wiki 上找到的陷阱列表;我不需要编辑我的注册表(无论如何我都无权访问它),所以也许把它作为最后的手段.

There are also a list of gotchas I found on the wiki; I didn't need to edit my registry (I don't have access to it anyway), so maybe leave that as a last resort.

也来自维基https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver

  • 必须下载 IEDriverServer 可执行文件并将其放置在您的 PATH 中.
  • 在 IE 7 或更高版本的 Windows Vista 或 Windows 7 上,您必须将每个区域的保护模式设置设置为相同的值.该值可以打开或关闭,只要每个区域都相同.要设置保护模式设置,请从工具"菜单中选择Internet 选项...",然后单击安全"选项卡.对于每个区域,标签底部都有一个标记为启用保护模式"的复选框.
  • 此外,IE 10 及更高版本必须禁用增强保护模式".此选项位于 Internet 选项对话框的高级选项卡中.
  • 浏览器缩放级别必须设置为 100%,以便可以将本机鼠标事件设置为正确的坐标.
  • 对于 Windows 10,您还需要在显示设置中将更改文本、应用和其他项目的大小"设置为 100%.
  • 仅对于 IE 11,您需要在目标计算机上设置一个注册表项,以便驱动程序可以保持与其创建的 Internet Explorer 实例的连接.对于 32 位 Windows 安装,您必须在注册表编辑器中检查的项是 HKEY_LOCAL_MACHINESOFTWAREMicrosoftInternet ExplorerMainFeatureControlFEATURE_BFCACHE.对于 64 位 Windows 安装,密钥是 HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftInternet ExplorerMainFeatureControlFEATURE_BFCACHE.请注意,FEATURE_BFCACHE 子项可能存在也可能不存在,如果不存在则应创建它.重要提示:在此键中,创建一个名为 iexplore.exe 且值为 0 的 DWORD 值.
  • The IEDriverServer exectuable must be downloaded and placed in your PATH.
  • On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".
  • Additionally, "Enhanced Protected Mode" must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.
  • The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
  • For Windows 10, you also need to set "Change the size of text, apps, and other items" to 100% in display settings.
  • For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINESOFTWAREMicrosoftInternet ExplorerMainFeatureControlFEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftInternet ExplorerMainFeatureControlFEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.

如果您收到错误提示

SessionNotCreatedError:启动 Internet Explorer 时出现意外错误.并非所有区域的保护模式设置都相同.必须将所有区域的启用保护模式设置为相同的值(启用或禁用).

然后您需要打开 IE 并确保所有区域的设置都相同,即可以全部开启或全部关闭,但必须相同.可能最好从一开始就尝试使用它,以减少与原始问题无关的不良行为者的风险.

Then you will need to open IE and make sure the the setting is the same for all zones, that is it can be on for all or off for all, but must be the same. Probably best to try it with it on for all to begin with to reduce the risk from bad actors unrelated to the original issues.

在企业环境中,这可能需要管理员访问权限,和/或可能需要在每次登录/重新启动后执行,因为它似乎可以通过策略设置(但这超出了我的知识范围).

In an enterprise environment this might need admin access, and/or it might need doing after every sign in/reboot as it seems it can be set by policy (But that is out of scope of my knowledge).

这篇关于Windows 10 上带有 IE 的量角器失败 - 错误代码 199的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆