我正在使用OpenBravo应用程序。在尝试使用文本ID类时,我遇到了点击元素的问题。我能够找到元素,但元素没有点击该按钮。
我在JavaScript中使用click()
事件和sendKeys()
操作,但它仍然无效。
答案 0 :(得分:-1)
driver.findElement(By.id("terminal_containerWindow_pointOfSale_DWCRM_UI_EmployeeIdPopup_bodyButtons_okButton")).click();
Html格式是
<div id="terminal_containerWindow_pointOfSale_DWCRM_UI_EmployeeIdPopup_bodyButtons_control">
<input style="width: 100%;margin-bottom:0px;background-color: #E8E8E8;width:300px" readonly="readonly" class="enyo-input input" id="terminal_containerWindow_pointOfSale_DWCRM_UI_EmployeeIdPopup_bodyButtons_EmployeeName" type="text" value="Kanika Sachdeva">
<br id="terminal_containerWindow_pointOfSale_DWCRM_UI_EmployeeIdPopup_bodyButtons_control2">
<input style="width: 100%;margin-bottom:0px;width:300px" maxlength="15" class="enyo-input input" id="terminal_containerWindow_pointOfSale_DWCRM_UI_EmployeeIdPopup_bodyButtons_EMPLOYEEID" placeholder="Enter Employee Id ..." type="text">
<br id="terminal_containerWindow_pointOfSale_DWCRM_UI_EmployeeIdPopup_bodyButtons_control3">
<button class="enyo-tool-decorator btnlink btnlink-gray modal-dialog-button" id="terminal_containerWindow_pointOfSale_DWCRM_UI_EmployeeIdPopup_bodyButtons_okButton">OK</button>
</div>