我目前正在学习使用量角器并尝试运行我的试用测试用例。我能够打开网络浏览器。成功打开 URL 后,测试失败并出现错误:“process exited with error code 1”
我的chrome版本:版本71.0.3578.98(官方版本)(64位)量角器版本:5.4.2 Webdriver版本:12.1.1
使用与我能够从此页面https://www.protractortest.org/#/tutorial获得成功结果相同的方法,我修改以输入我的 URL 和元素。但失败了。
我使用名称而不是型号。以下是我的页面中的元素:
<input _ngcontent-c1="" class="mat-input-element mat-form-field-autofill-control cdk-text-field-autofill-monitored ng-untouched ng-pristine ng-valid" matinput="" name="email" placeholder="Email" required="" id="mat-input-0" aria-invalid="false" aria-required="true">
Run Code Online (Sandbox Code Playgroud)
我尝试在谷歌页面上执行相同的操作,但也面临相同的结果。
//conf.js
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js'],
capabilities: {
browserName: 'chrome'
}
}
Run Code Online (Sandbox Code Playgroud)
// 规范.js
describe('Protractor Demo App', function() {
it('enter search word in google search field', function() {
browser.get('https://www.google.com/');
element(by.name('q')).sendKeys('protractor for angular testing');
browser.sleep('10000');
});
});
Run Code Online (Sandbox Code Playgroud)
我希望能够在搜索字段中成功输入字符串“用于角度测试的量角器”。
我正在尝试在不同的计算机上设置量角器。它与我的另一台计算机使用相同的文件(无法使用,因为 hdisc 损坏)。
它在我的另一台计算机上运行良好,但是当我尝试在这台计算机上运行量角器时出现错误“进程退出,错误代码 100”。
我尝试删除节点模块,清理缓存并再次执行 npm install 以安装依赖项。它有助于我之前的问题(无法运行 webdriver),但现在导致我出现这个问题。
[14:44:09] I/launcher - Running 1 instances of WebDriver
[14:44:09] I/local - Starting selenium standalone server...
[14:44:11] E/launcher - Error: Error: Server terminated early with status 1
at earlyTermination.catch.e (C:\Users\PMO\Documents\DG\Jasmine\node_modules\selenium-webdriver\remote\index.js:252:52)
at process._tickCallback (internal/process/next_tick.js:68:7)
[14:44:11] E/launcher - Process exited with error code 100
npm ERR! code ELIFECYCLE
npm ERR! errno 100
npm ERR! ProtractorTutorial@ protractor: `protractor conf.js`
npm ERR! Exit status 100
npm ERR!
npm ERR! Failed at the protractor@ protractor script. …Run Code Online (Sandbox Code Playgroud)