量角器测试用例在 Internet Explorer 11 中不起作用
Protractor Test Cases Not Working in Internet Explorer 11
Protractor 测试用例在 Windows 10 Enterprise
上的 Internet Explorer 11 中不起作用
Protractor.conf.js has below configuration.
seleniumAddress: 'http://localhost:4444/wd/hub',
seleniumArgs: ['-Dwebdriver.ie.driver=node_modules/protractor/selenium/IEDriverServer.exe'],
multiCapabilities: [
{
browserName: 'internet explorer',
'platform': 'ANY',
'version': '11'
}
]
当我尝试 运行 任一 ng e2e 命令到 运行 测试用例时,我得到
Driver.version: unknown exception like below.
**Exception Trace:**
[11:37:33] I/update - chromedriver: chromedriver_2.42.exe up to date
[11:37:33] I/launcher - Running 1 instances of WebDriver
[11:37:33] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[11:37:37] E/launcher - Unable to create session from {
"desiredCapabilities": {
"count": 1,
"browserName": "internet explorer",
"version": "11",
"platform": "ANY"
},
"capabilities": {
"firstMatch": [
{
"browserName": "internet explorer"
}
]
}
}
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'DN13961', ip: '10.12.56.135', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: unknown
[11:37:37] E/launcher - SessionNotCreatedError: Unable to create session from {
"desiredCapabilities": {
"count": 1,
"browserName": "internet explorer",
"version": "11",
"platform": "ANY"
},
"capabilities": {
"firstMatch": [
{
"browserName": "internet explorer"
}
]
}
}
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'DN13961', ip: '10.12.56.135', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\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\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
at createDriver (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\index.js:170:33)
at Builder.build (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\index.js:635:14)
at Hosted.getNewDriver (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\protractor\built\driverProviders\driverProvider.js:53:33)
at Runner.createBrowser (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\protractor\built\runner.js:195:43)
at q.then.then (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\protractor\built\runner.js:339:29)
at _fulfilled (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:796:13)
at C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:556:49
at runSingle (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:137:13)
at flush (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
[11:37:37] E/launcher - Process exited with error code 199
我做了如下几个试验。
- 我试过手动下载 IEDriverServer.exe 并在 运行ning ng e2e 之前手动启动它。
- 下载 IEDriverServer.exe 并复制到 selenium 目录下
\node_modules\protractor\node_modules\webdriver-manager\selenium
然后 运行 webdriver-manager update
和 webdriver-manager start
然后 ng e2e
但是我'我遇到了同样的异常。
这是根据 link 上提供的建议解决了我的问题。我已经打开 'Registry Editor',确实转到了下面的路径。
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\
然后通过右键单击 -> FEATURE_BECACHE
-> 然后右键单击此功能然后创建新功能 ->DWORD (32-Bit Value)
然后重命名创建的 DWORD
作为 -> 'iexplore.exe'
检查下面的 link 以了解正在进行的注册表设置。
enter image description here
- package.json 将有如下脚本。 (您必须将其添加到脚本标签下)。
"webdriver-nodemodules-update-all-drivers": "cd .\node_modules\protractor\node_modules\webdriver-manager\bin & webdriver-manager update --standalone & webdriver-manager update --versions.gecko=v0.22.0 & webdriver-manager update --ie"
确保 protractor.conf.js 具有 localSeleniumStandaloneOpts 和 multiCapabilities Code Image. Do like this. 图像代码片段(未格式化)如下(复制下面的代码并将其格式化到您的 ide- 请请在此处参考代码图像并进行配置。)protractor.conf 并格式化代码。
//直接连接:真,
localSeleniumStandaloneOpts:{
//jvmArgs : ["-Dwebdriver.ie.driver="] // 例如: "node_modules/protractor/node_modules/webdriver-manager/selenium/IEDriverServer_x64_X.XX.X.exe"
jvmArgs : ["-Dwebdriver.ie.driver=node_modules//protractor//node_modules//webdriver-manager//selenium//IEDriverServer3.14.0.exe"] // 例如: "node_modules/protractor/node_modules/webdriver-manager/selenium/IEDriverServer_x64_X.XX.X.exe"
},
'autoStartStopServer':是的,
多重能力:[
{
'browserName': 'chrome',
铬选项:{
// args: ['--headless', '--disable-gpu', '--window-size=1920,1080']
},
acceptInsecureCerts:真,
shardTestFiles:真
},
{
'browserName': 'firefox',
'marionette':是的,
火狐选项:{
// 参数:['--headless']
},
'moz:firefoxOptions':{
args: [ '--headless' ]
},
直接连接:假的,
},
{
'browserName': 'internet explorer',
'platform': 'ANY',
'version': '11'
}
],
然后执行 运行 3 个命令 - 'npm install'、'npm run webdriver-nodemodules-update-all-drivers' 然后 'ng e2e' 到 运行 上的测试用例 (chrome/firefox/internet explorer) 浏览器。请注意,webdriver-nodemodules-update-all-drivers 命令只会 运行 如果您已执行步骤 1.
Protractor 测试用例在 Windows 10 Enterprise
上的 Internet Explorer 11 中不起作用Protractor.conf.js has below configuration.
seleniumAddress: 'http://localhost:4444/wd/hub',
seleniumArgs: ['-Dwebdriver.ie.driver=node_modules/protractor/selenium/IEDriverServer.exe'],
multiCapabilities: [
{
browserName: 'internet explorer',
'platform': 'ANY',
'version': '11'
}
]
当我尝试 运行 任一 ng e2e 命令到 运行 测试用例时,我得到
Driver.version: unknown exception like below.
**Exception Trace:**
[11:37:33] I/update - chromedriver: chromedriver_2.42.exe up to date
[11:37:33] I/launcher - Running 1 instances of WebDriver
[11:37:33] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[11:37:37] E/launcher - Unable to create session from {
"desiredCapabilities": {
"count": 1,
"browserName": "internet explorer",
"version": "11",
"platform": "ANY"
},
"capabilities": {
"firstMatch": [
{
"browserName": "internet explorer"
}
]
}
}
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'DN13961', ip: '10.12.56.135', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: unknown
[11:37:37] E/launcher - SessionNotCreatedError: Unable to create session from {
"desiredCapabilities": {
"count": 1,
"browserName": "internet explorer",
"version": "11",
"platform": "ANY"
},
"capabilities": {
"firstMatch": [
{
"browserName": "internet explorer"
}
]
}
}
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'DN13961', ip: '10.12.56.135', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\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\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
at createDriver (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\index.js:170:33)
at Builder.build (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\selenium-webdriver\index.js:635:14)
at Hosted.getNewDriver (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\protractor\built\driverProviders\driverProvider.js:53:33)
at Runner.createBrowser (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\protractor\built\runner.js:195:43)
at q.then.then (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\protractor\built\runner.js:339:29)
at _fulfilled (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:796:13)
at C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:556:49
at runSingle (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:137:13)
at flush (C:\Users\atptszk\Documents\bcui1001\bcui-trial01\bcui\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
[11:37:37] E/launcher - Process exited with error code 199
我做了如下几个试验。
- 我试过手动下载 IEDriverServer.exe 并在 运行ning ng e2e 之前手动启动它。
- 下载 IEDriverServer.exe 并复制到 selenium 目录下
\node_modules\protractor\node_modules\webdriver-manager\selenium
然后 运行webdriver-manager update
和webdriver-manager start
然后ng e2e
但是我'我遇到了同样的异常。
这是根据 link 上提供的建议解决了我的问题。我已经打开 'Registry Editor',确实转到了下面的路径。
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\
然后通过右键单击 -> FEATURE_BECACHE
-> 然后右键单击此功能然后创建新功能 ->DWORD (32-Bit Value)
然后重命名创建的 DWORD
作为 -> 'iexplore.exe'
检查下面的 link 以了解正在进行的注册表设置。
enter image description here
- package.json 将有如下脚本。 (您必须将其添加到脚本标签下)。
"webdriver-nodemodules-update-all-drivers": "cd .\node_modules\protractor\node_modules\webdriver-manager\bin & webdriver-manager update --standalone & webdriver-manager update --versions.gecko=v0.22.0 & webdriver-manager update --ie" 确保 protractor.conf.js 具有 localSeleniumStandaloneOpts 和 multiCapabilities Code Image. Do like this. 图像代码片段(未格式化)如下(复制下面的代码并将其格式化到您的 ide- 请请在此处参考代码图像并进行配置。)protractor.conf 并格式化代码。
//直接连接:真, localSeleniumStandaloneOpts:{ //jvmArgs : ["-Dwebdriver.ie.driver="] // 例如: "node_modules/protractor/node_modules/webdriver-manager/selenium/IEDriverServer_x64_X.XX.X.exe" jvmArgs : ["-Dwebdriver.ie.driver=node_modules//protractor//node_modules//webdriver-manager//selenium//IEDriverServer3.14.0.exe"] // 例如: "node_modules/protractor/node_modules/webdriver-manager/selenium/IEDriverServer_x64_X.XX.X.exe" }, 'autoStartStopServer':是的, 多重能力:[ { 'browserName': 'chrome', 铬选项:{ // args: ['--headless', '--disable-gpu', '--window-size=1920,1080'] }, acceptInsecureCerts:真, shardTestFiles:真 }, { 'browserName': 'firefox', 'marionette':是的, 火狐选项:{ // 参数:['--headless'] }, 'moz:firefoxOptions':{ args: [ '--headless' ] }, 直接连接:假的, }, { 'browserName': 'internet explorer', 'platform': 'ANY', 'version': '11' } ],
然后执行 运行 3 个命令 - 'npm install'、'npm run webdriver-nodemodules-update-all-drivers' 然后 'ng e2e' 到 运行 上的测试用例 (chrome/firefox/internet explorer) 浏览器。请注意,webdriver-nodemodules-update-all-drivers 命令只会 运行 如果您已执行步骤 1.