我有量角器测试,并且在本地使用VS代码中的protractor protractor.conf.js --suite full
运行带有命令测试的测试。 VS代码可以运行chrome实例,并且可以很好地执行测试。
之后,我设置了詹金斯工作以进行量角器测试。我的步骤:
npm install
node_modules\.bin\ng e2e --webdriver-update
Jenkins在http://localhost:49156/ **
上打开了chrome浏览器,并从量角器测试开始。
在Chrome浏览器上,我的测试可以按ID,HTML,text
来查找元素,但是当需要单击元素时,会出现此错误[31m- [39m[31mFailed: element not interactable
。
这是控制台输出的一部分:
[15:37:51] W/element - more than one element found for locator by.buttonText("Create") - the first result will be used
Creating configuration for
[31m× Creating default configuration [39m
[31m- [39m[31mFailed: element not interactable
(Session info: chrome=69.0.3497.100)
(Driver info: chromedriver=2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5),platform=Windows NT 6.2.9200 x86_64)[39m
(Session info: chrome=69.0.3497.100)
(Driver info: chromedriver=2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5),platform=Windows NT 6.2.9200 x86_64)
at Object.checkLegacyResponse (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\selenium-webdriver\lib\http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
From: Task: WebElement.click()
这是量角器测试:
it('Creating default configuration 2000 ', () => {
_home.get2000Configuration().click();
_descriptionModal.buttonStartCreate().click();
for (let i = 0; i < 4; i++) {
_wizardModal.buttonNext().click();
}
_descriptionModal.buttonCreate().click();
expect(_configurationView.getBaImage().isDisplayed()).toBe(true).then(function (result) {
expect(_configurationView.getNeb().count()).toBe(2);
expect(_configurationView.getmage().count()).toBe(2);
expect(_configurationView.getEngineImage().isDisplayed()).toBe(true);
});
});
答案 0 :(得分:0)
检查您发布的错误堆栈,我可以看到:
[15:37:51] W/element - more than one element found for locator by.buttonText("Create") - the first result will be used
我的猜测是,带有多个“创建”文本的按钮,您的代码正在丢失。我建议检查一下按钮名称,并确保例如只有一个具有“创建”标签。