我无法在Windows 10上使用量角器与IE 11一起工作。它说Unable to create new service: InternetExplorerDriverService
并且存在代码199
我已经尝试了旧的重新安装/升级节点,npm,量角器,webdriver-manager& java的;它似乎没有任何区别。
量角器适用于Chrome;并且配置中的Chrome不会影响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:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (C:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (C:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
at Function.createSession (C:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
at createDriver (C:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\index.js:170:33)
at Builder.build (C:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\index.js:635:14)
at Local.getNewDriver (C:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\built\driverProviders\driverProvider.js:53:33)
at Runner.createBrowser (C:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\built\runner.js:195:43)
at q.then.then (C:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\built\runner.js:339:29)
at _fulfilled (C:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:796:13)
at C:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:604:44
[15:37:53] E/launcher - Process exited with error code 199
手动运行InternetExplorerDriverService会打开一个显示
的窗口Started InternetExplorerDriver server (32-bit)
3.9.0.0
Listening on port 5555
Only local connections are allowed
但这并没有改变结果。
答案 0 :(得分:2)
为我做的主要事情是重命名下载的文件! npm / selenium在绝望中下载C:\Users\my.username\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\IEDriverServer3.9.0.exe
我删除了版本,将其重命名为同一文件夹中的IEDriverServer.exe
;这就行了。
由于该项目的环境性质,我还需要让安全团队允许它运行;这可能不适用于所有人。
我还在维基上找到了一系列陷阱;我不需要编辑我的注册表(无论如何我都无法访问它),所以也许留下它作为最后的手段。
也来自Wiki https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE
。对于64位Windows安装,密钥为HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE
。请注意,FEATURE_BFCACHE
子项可能存在也可能不存在,如果不存在,则应创建该子项。重要说明:在此密钥内,创建名为iexplore.exe的DWORD
值,值为0. 如果您收到错误
SessionNotCreatedError: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones.
然后你需要打开IE并确保所有区域的设置都相同,即它可以全部打开或全部关闭,但必须相同。可能最好先尝试一下,以减少与原始问题无关的坏人的风险。
在企业环境中,这可能需要管理员访问权限,和/或它可能需要在每次登录/重新启动后执行,因为它似乎可以通过策略设置(但这超出了我的知识范围)。