我正在尝试按照https://docs.angularjs.org/tutorial上的教程运行命令
时出错npm run protractor
这是控制台日志:
Microsoft Windows [Version 6.1.7601]版权所有(c)2009 Microsoft 公司。保留所有权利。
C:\ GIT \ angular-practices \ angular-phonecat> npm run protractor
angular-phonecat@0.0.0 preprotractor C:\ GIT \ angular-practices \ angular-phonecat npm运行update-webdriver
angular-phonecat@0.0.0 preupdate-webdriver C:\ GIT \ angular-practices \ angular-phonecat npm install
angular-phonecat@0.0.0 postinstall C:\ GIT \ angular-practices \ angular-phonecat 凉亭安装
angular-phonecat@0.0.0 update-webdriver C:\ GIT \ angular-practices \ angular-phonecat webdriver-manager更新
selenium standalone是最新的。 chromedriver是最新的。
angular-phonecat@0.0.0量角器C:\ GIT \ angular-practices \ angular-phonecat 量角器测试/量角器-conf.js
util.puts:使用console.log而不是直接使用ChromeDriver ... 错误:生成UNKNOWN at exports._errnoException(util.js:746:11) 在ChildProcess.spawn(child_process.js:1162:11) 在exports.spawn(child_process.js:995:9) 在C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ selenium-webdriver \ remote \ index.js:173:23 在C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ selenium-webdriver \ lib \ goog \ base.js:1243:15 at [object Object] .webdriver.promise.ControlFlow.runInNewFrame_(C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ selenium-webdriver \ lib \ webdriver \ prom ise.js:1539:20) 在notify(C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ selenium-webdriver \ lib \ webdriver \ promise.js:362:12) 在[object Object] .then(C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ selenium-webdriver \ lib \ webdriver \ promise.js:414:7) 在Object.webdriver.promise.when(C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ selenium-webdriver \ lib \ webdriver \ promise.js:639:18) 在C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ selenium-webdriver \ remote \ index.js:172:20 ====异步任务==== WebDriver.createSession() 在Function.webdriver.WebDriver.acquireSession_(C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ selenium-webdriver \ lib \ webdriver \ webdriver.js:131:49) 在Function.webdriver.WebDriver.createSession(C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ selenium-webdriver \ lib \ webdriver \ webdriver.js:111:30) at Object.createDriver(C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ selenium-webdriver \ chrome.js:460:30) 在ChromeDriverProvider.getDriver(C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ lib \ driverProviders \ chrome.js:67:27) 在C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ lib \ runner.js:221:35 在_fulfilled(C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ q \ q.js:797:54) at self.promiseDispatch.done(C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ q \ q.js:826:30) 在Promise.promise.promiseDispatch(C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ q \ q.js:759:13) 在C:\ GIT \ angular-practices \ angular-phonecat \ node_modules \ protractor \ node_modules \ q \ q.js:525:49
你能告诉我问题出在哪里吗?
这是我的量角器conf.js:
exports.config = {
allScriptsTimeout: 11000,
specs: [
'e2e/*.js'
],
capabilities: {
'browserName': 'chrome'
},
chromeOnly: true,
baseUrl: 'http://localhost:8000/',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
答案 0 :(得分:4)
对于使用 Mac 并收到此错误的用户,以下未解决的问题可能会导致此问题:https://github.com/angular/webdriver-manager/issues/476
解决方案由 ciekawy 提供。 在
node_modules/webdriver-manager/built/lib/files/file_manager.js
或
node_modules/protractor/webdriver-manager/built/lib/files/file_manager.js
在第 166 行添加以下代码:
fileUrl.url = fileUrl.url.replace(/_m1/, '');
然后,您需要更新 chrome 驱动程序以进行更改。如果使用 NRWL 的 NX monorepo 管理工具:
npx webdriver-manager clean
npx webdriver-manager update --gecko=false --versions.chrome=<version from chrome://versions>
答案 1 :(得分:0)
更改为 chromeOnly:false
@Entity
@NamedQuery(name = "findAllBooks", query = "select b from Book b")
public class Book implements Serializable {
@Id
@GeneratedValue
private long id;
...
}
您可以在#176 找到