我protractor.conf.js(相關部分)量角器在無頭的鍍鉻如果我運行在所有測試中通過正常模式量角器不執行browser.actions()
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['headless', 'disable-gpu']
}
}
。以及如果我用map.click()替換這段代碼。
browser.actions()
.mouseDown()
.mouseMove(map, {x: 500, y: 150})
.click()
.mouseDown()
.perform();
編輯:我之前沒有添加錯誤,因爲我認爲他們在我的情況下沒用。但在這裏他們是因爲有人認爲他們是相關的。
失敗:
1) Protractor Demo App place sorting should create 2 places on different distances from map center Message: Expected 0 to be 2. Stack: Error: Failed expectation at Object.it (/home/piliponful/projects/mocha-test/spec.js:138:38) at /home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/jasminewd2/index.js:112:25 at new ManagedPromise (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1067:7) at ControlFlow.promise (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2396:12) at schedulerExecute (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/jasminewd2/index.js:95:18) at TaskQueue.execute_ (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2970:14) at TaskQueue.executeNext_ (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2953:27) at asyncRun (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2860:25) at /home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:676:7 at process._tickCallback (internal/process/next_tick.js:109:7)
2) Protractor Demo App place sorting should sort places Message: Expected 0 to be 2. Stack: Error: Failed expectation at Object.it (/home/piliponful/projects/mocha-test/spec.js:148:38) at /home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/jasminewd2/index.js:112:25 at new ManagedPromise (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1067:7) at ControlFlow.promise (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2396:12) at schedulerExecute (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/jasminewd2/index.js:95:18) at TaskQueue.execute_ (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2970:14) at TaskQueue.executeNext_ (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2953:27) at asyncRun (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2860:25) at /home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:676:7 at process._tickCallback (internal/process/next_tick.js:109:7) Message: Failed: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator by.binding("place.title") Stack: NoSuchElementError: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator by.binding("place.title") at selenium_webdriver_1.promise.all.then (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/lib/element.ts:287:17) at ManagedPromise.invokeCallback_ (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1366:14) at TaskQueue.execute_ (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2970:14) at TaskQueue.executeNext_ (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2953:27) at asyncRun (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2813:27) at /home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:676:7 at process._tickCallback (internal/process/next_tick.js:109:7)Error at ElementArrayFinder.applyAction_ (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/lib/element.ts:482:23) at ElementArrayFinder.(anonymous function).args [as getText] (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/lib/element.ts:96:21) at ElementFinder.(anonymous function).args [as getText] (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/lib/element.ts:873:14) at placeListText.then.places (/home/piliponful/projects/mocha-test/spec.js:150:38) at ManagedPromise.invokeCallback_ (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1366:14) at TaskQueue.execute_ (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2970:14) at TaskQueue.executeNext_ (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2953:27) at asyncRun (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2813:27) at /home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:676:7 at process._tickCallback (internal/process/next_tick.js:109:7) From: Task: Run it("should sort places") in control flow at Object. (/home/piliponful/.nvm/versions/node/v7.10.0/lib/node_modules/protractor/node_modules/jasminewd2/index.js:94:19) at runCallback (timers.js:672:20) at tryOnImmediate (timers.js:645:5) at processImmediate [as _immediateCallback] (timers.js:617:5) From asynchronous test: Error at Suite.describe (/home/piliponful/projects/mocha-test/spec.js:140:5) at Suite.describe (/home/piliponful/projects/mocha-test/spec.js:87:3) at Object. (/home/piliponful/projects/mocha-test/spec.js:1:1) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17)
13 specs, 3 failures
您的問題似乎是一半?你遇到了什麼錯誤? – demouser123
我添加了錯誤。 – Piliponful
我會查看chrome-headless是否在他們的文檔中支持這些功能。 – cnishina