我想通过Protractor 2.0在Node.JS上运行Selenium的跨浏览器测试。
FF& Chrome正常运行,只有IE11无法打开。
当我尝试时,我得到以下错误:
c:\automation\tests>protractor conf.js
[launcher] Running 3 instances of WebDriver
------------------------------------
[internet explorer #3] PID: 8904
[internet explorer #3] Specs: c:\automation\tests\message.js
[internet explorer #3]
[internet explorer #3] Using the selenium server at http://localhost:4444/wd/hub
[internet explorer #3] ERROR - Unable to start a WebDriver session.
[internet explorer #3]
[internet explorer #3] C:\Users\idan\AppData\Roaming\npm\node_modules\protractor
\node_modules\selenium-webdriver\lib\atoms\error.js:113
[internet explorer #3] var template = new Error(this.message);
[internet explorer #3] ^
[internet explorer #3] UnknownError: The path to the driver executable must be s
et by the webdriver.ie.driver system property; for more information, see http://
code.google.com/p/selenium/wiki/InternetExplorerDriver. The latest version can b
e downloaded from http://selenium-release.storage.googleapis.com/index.html
[internet explorer #3] at new bot.Error (C:\Users\idan\AppData\Roaming\npm\n
ode_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:113:18
)
[internet explorer #3] at Object.bot.response.checkResponse (C:\Users\idan\A
ppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\a
toms\response.js:106:9)
[internet explorer #3] at C:\Users\idan\AppData\Roaming\npm\node_modules\pro
tractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:158:24
[internet explorer #3] at [object Object].promise.ControlFlow.runInFrame_ (C
:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-w
ebdriver\lib\webdriver\promise.js:1877:20)
[internet explorer #3] at [object Object].promise.Callback_.goog.defineClass
.notify (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\
selenium-webdriver\lib\webdriver\promise.js:2464:25)
[internet explorer #3] at [object Object].promise.Promise.notify_ (C:\Users\
idan\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver
\lib\webdriver\promise.js:563:12)
[internet explorer #3] at Array.forEach (native)
[internet explorer #3] at Object.goog.array.forEach (C:\Users\idan\AppData\R
oaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\arra
y\array.js:203:43)
[internet explorer #3] at [object Object].promise.Promise.notifyAll_ (C:\Use
rs\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdri
ver\lib\webdriver\promise.js:552:16)
[internet explorer #3] at goog.async.run.processWorkQueue (C:\Users\idan\App
Data\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goo
g\async\run.js:125:21)
[internet explorer #3] From: Task: WebDriver.createSession()
[internet explorer #3] at Function.webdriver.WebDriver.acquireSession_ (C:\U
sers\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webd
river\lib\webdriver\webdriver.js:155:22)
[internet explorer #3] at Function.webdriver.WebDriver.createSession (C:\Use
rs\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdri
ver\lib\webdriver\webdriver.js:129:30)
[internet explorer #3] at [object Object].Builder.build (C:\Users\idan\AppDa
ta\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\builder.j
s:416:22)
[internet explorer #3] at [object Object].DriverProvider.getNewDriver (C:\Us
ers\idan\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\driverP
rovider.js:38:7)
[internet explorer #3] at [object Object].Runner.createBrowser (C:\Users\ida
n\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:180:37)
[internet explorer #3] at C:\Users\idan\AppData\Roaming\npm\node_modules\pro
tractor\lib\runner.js:257:21
[internet explorer #3] at _fulfilled (C:\Users\idan\AppData\Roaming\npm\node
_modules\protractor\node_modules\q\q.js:797:54)
[internet explorer #3] at self.promiseDispatch.done (C:\Users\idan\AppData\R
oaming\npm\node_modules\protractor\node_modules\q\q.js:826:30)
[internet explorer #3] at Promise.promise.promiseDispatch (C:\Users\idan\App
Data\Roaming\npm\node_modules\protractor\node_modules\q\q.js:759:13)
[internet explorer #3] at C:\Users\idan\AppData\Roaming\npm\node_modules\pro
tractor\node_modules\q\q.js:573:44
[launcher] Runner process exited unexpectedly with error code: 1
[launcher] 2 instance(s) of WebDriver still running
我的配置文件:
exports.config = {
chromeDriver: 'npm/node_modules/protractor/selenium/chromedriver',
chromeOnly: false,
seleniumAddress: 'http://localhost:4444/wd/hub',
seleniumArgs: [],
specs: ['message.js'],
// -=-=- Test cases: -=-=-
// 'onboarding.js', 'meeting.js', 'message.js', 'document.js', 'payments.js'
multiCapabilities: [{
'browserName': 'firefox',
'cli': {
'args': ['webdriver.firefox.useExisting=default']
// 'args': ['webdriver.firefox.useExisting=default', '-jsconsole', '-jsdebugger']
}},
{
'browserName': 'chrome',
'chromeOptions': {
args: ['--test-type','--memory-metrics','--console','--crash-on-failure']
// '--load-extension=' + 'C:\\Users\\idan\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Extensions\\idgpnmonknjnojddfkpgkljpfnnfcklj\\1.2.4_0'
// }
}},
{
'browserName': 'internet explorer'
}],
// rootElement: '.main',
framework: "jasmine",
allScriptsTimeout: 10000,
getPageTimeout: 10000,
请帮助你!
谢谢:)
答案 0 :(得分:1)
IE驱动程序未与量角器捆绑在一起。
您需要下载IE驱动程序,找到here。并将可执行文件放在C:\Users\username\AppData\Roaming\npm\node_modules\protractor\selenium
。