我在eclipse中运行量角器脚本时遇到问题,我的spec.js文件包括:
describe('angularjs homepage todo list', function() {
it('should add a todo', function() {
browser.get('https://angularjs.org');
element(by.model('todoList.todoText')).sendKeys('write first protractor test');
element(by.css('[value="add"]')).click();
var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write first protractor test');
// You wrote your first test, cross it off the list
todoList.get(2).element(by.css('input')).click();
var completedAmount = element.all(by.css('.done-true'));
expect(completedAmount.count()).toEqual(2);
});
});
和conf.js文件包括:
// conf.js
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']
}
当我运行conf.js文件时,chrome浏览器已成功打开但在等待一段时间后,控制台上会显示以下错误:
[12:15:58] I/launcher - Running 1 instances of WebDriver
[12:15:58] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[12:16:59] E/launcher - unknown error: Devtools port number file contents <50477> were in an unexpected format
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.17 seconds
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'HKAUR7-QA', ip: '10.8.11.172', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_92'
Driver info: driver.version: unknown
[12:16:59] E/launcher - WebDriverError: unknown error: Devtools port number file contents <50477> were in an unexpected format
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.17 seconds
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'HKAUR7-QA', ip: '10.8.11.172', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_92'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (D:\Selenium_Workspace\ProtractorJavaScriptProject5\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 (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
at Function.createSession (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\selenium-webdriver\chrome.js:761:15)
at createDriver (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\selenium-webdriver\index.js:170:33)
at Builder.build (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\selenium-webdriver\index.js:626:16)
at Hosted.getNewDriver (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\protractor\built\driverProviders\driverProvider.js:53:33)
at Runner.createBrowser (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\protractor\built\runner.js:195:43)
at q.then.then (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\protractor\built\runner.js:339:29)
at _fulfilled (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\q\q.js:796:13)
[12:16:59] E/launcher - Process exited with error code 199
请建议。
答案 0 :(得分:0)
我得到了相同的错误消息,因为我在chromedriver-2.40中使用了过时版本的chrome。 chromedriver-2.40的release notes表示它支持chrome版本66-68。从较旧的版本升级到Chrome 67可以解决我的错误。