我曾经多次面对过这个问题。我有一个代码设置,其中实习生输入输入元素的某些输入,然后单击提交按钮。但实习生在点击按钮时出现错误。 我的代码设置如下:
// other tests
"Load Client":function(){
var self = this
return inputs.Clients.reduce(function (chain, client) {
isNA = false;
return chain
.then(viewClientPage.clickOnAddClientBtn())
.then(addClientModal.clientName.enterValue(client.ClientName))
.then(function () {
return client.LineOfBusiness.reduce(function (chain1, lob) {
return chain1
.then(addClientModal.stateLOB.selectOption(lob.LOBName))
.then(addClientModal.state.clearValue())
.then(function () {
return lob.States.reduce(function (chain2, state) {
if (state.StateName == 'N/A') {
isNA = true;
return chain2
.then(addClientModal.selectAllStateCheckBox())
} else {
return chain2
.then(addClientModal.state.enterValue(state.StateName))
}
}, self.remote);
})
.then(addClientModal.clickOnAddStateBtn())
}, self.remote);
})
.sleep(6000)
.findByXpath('//*[@id="saveModal"]').click().end() // this is raising error
}, this.remote)
}
我得到的错误是
UnknownError: [POST http://localhost:4444/wd/hub/session/737b17818334be969beb0ce6a8174f12/element/0.48698099328565236-11/click] unknown error: Element <button type="button" class="btn btn-primary save" style="float:right" ng-click="addNewPayer('Payers','clients/clients/partials/addNewPayerModal.tpl.html','...',client,editParameters)">Add Client</button> is not clickable at point (1296, 112). Other element would receive the click: <div tabindex="-1" role="dialog" class="modal fade ng-isolate-scope custommodal-modal-edit in" ng-class="{in: animate}" ng-style="{'z-index': 1050 + index*10, display: 'block'}" ng-click="close($event)" modal-window="" window-class="custommodal-modal-edit" size="lg" index="0" animate="animate" style="z-index: 1050; display: block;">...</div>
(Session info: chrome=63.0.3239.84)
(Driver info: chromedriver=2.34.522940
(1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 6.1.7601 SP1
x86_64)
at runRequest <node_modules\leadfoot\Session.js:92:40>
at <node_modules\leadfoot\Session.js:113:39>
at new Promise <node_modules\dojo\Promise.ts:411:3>
at ProxiedSession._post <node_modules\leadfoot\Session.js:67:10>
at Element._post <node_modules\leadfoot\Element.js:23:31>
at Element.click <node_modules\leadfoot\Element.js:197:15>
at Command.<anonymous> <node_modules\leadfoot\Command.js:680:19>
at <node_modules\dojo\Promise.ts:393:15>
at run <node_modules\dojo\Promise.ts:237:7>
at <node_modules\dojo\nextTick.ts:44:3>
at Command.target.(anonymous function) [as click]
<node_modules\leadfoot\Command.js:674:11>
at Command.<anonymous>
<Automation\pageObjects\pages\clientSetup\clients\viewClientsPage\ViewClientPage.js:61:71>
at runCallback <node_modules\leadfoot\Command.js:526:31>
at Command.<anonymous> <node_modules\leadfoot\Command.js:543:11>
at <node_modules\dojo\Promise.ts:393:15>
at run <node_modules\dojo\Promise.ts:237:7>
at <node_modules\dojo\nextTick.ts:44:3>
at _combinedTickCallback <internal\process\next_tick.js:67:7>
at process._tickCallback <internal\process\next_tick.js:98:9>
at Command.then <node_modules\leadfoot\Command.js:542:10>
at <Automation\Data_Load\LoadSM2Data.js:61:30>
at Array.reduce <native>
at Test.Load Clients [as test] <Automation\Data_Load\LoadSM2Data.js:56:35>
at <node_modules\intern\lib\Test.js:191:24>
at <node_modules\intern\browser_modules\dojo\Promise.ts:393:15>
at runCallbacks <node_modules\intern\browser_modules\dojo\Promise.ts:11:11>
at <node_modules\intern\browser_modules\dojo\Promise.ts:317:4>
at run <node_modules\intern\browser_modules\dojo\Promise.ts:237:7>
at <node_modules\intern\browser_modules\dojo\nextTick.ts:44:3>
我尝试更改seenium-server-standalone.jar
chromedriver.exe
的版本,甚至尝试使用findByXpath
,findById
等,但这些都没有奏效。请帮助我完成
感谢。
答案 0 :(得分:0)
错误表示标签为“添加客户端”的按钮无法点击,因为模式对话框会收到点击。首先,这实际上是应该点击的按钮吗?如果没有,那么提供给findBy
的搜索词将需要改进。
假设这是正确的按钮,是否在点击操作发生时被模态对话框遮挡?如果是,请采取措施确保对话框已关闭。