我遇到的情况,在Add Address button
和Address Detail Modal dialog window
用户click
的出现,无法找到模态对话框窗口中的文本框?
它有4个元素的地址详细信息两个文本框和两个按钮添加和取消。
我可以直接点击模型对话窗口中的取消和添加按钮,但无法找到其中的文本框。
下面是模态对话窗口中文本框的代码。
input id="Address" class="form-control" type="text" value="" name="Address" data-toggle
="tooltip" data-placement="bottom" data-bind="value:Address, ValidationMessage: Address"
data-original-title="" title=""
如何访问模式对话框元素的型号为对话窗口的same window
所以Alert
和Window switching methods
部分可能是在这种情况下没有什么用处? 请任何意见?
更新我想要的示例代码。
// Click on Address link It open Model window
driver.findElement(By.xpath(".//div[@id='member_78121']div/table/tfoot/tr/td/div/button")).click();
here i am giving wait condition.
//Inside modal window
//TextBox first
driver.findElement(By.id("AddressLine1")).sendKeys("plot no-23");
//textbox second
driver.findElement(By.id("AddressLine2")).sendKeys("plot no-23");
//Add button
driver.findElement(By.id("Add")).click();
// driver.findElement(By.id("Cancel")).click();
here i am able to click on Add or Cancel button if you comments text boxes code but
i am getting error for textboxes "element is not visible"
这是添加按钮的代码以供参考
button id="Add" class="btn btn-default" value="Add" type="button" title="" name="Add"
data-toggle="tooltip" data-placement="bottom" data-bind="click:$parent.SaveAndCloseAddressPopup, Tooltip:$parent.SaveAndCloseAddressPopup"
data-original-title="Save changes and close"
错误:“元素是不可见的”我试图等待也 – Eknath
有甚至是其他窗口都不是iframe。 – Eknath