2016-05-31 123 views
0

我遇到的情况,在Add Address buttonAddress 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 所以AlertWindow 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" 
+0

错误:“元素是不可见的”我试图等待也 – Eknath

+0

有甚至是其他窗口都不是iframe。 – Eknath

回答

0

//点击地址链接它打开模型窗口

driver.findElement(By.xpath(” .// DIV [@ 。ID = 'member_78121'] DIV /表/ TFOOT/TR/TD/DIV /键“))点击();

这里我给等待条件。

//内模态窗口

//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( “取消”))点击()。

在这里,我能够点击添加或删除按钮,如果你的评论文本框代码 但我得到错误的文本框“元素是不可见的”

这是添加按钮的代码以供参考

按钮id =“添加”class =“btn btn-default”value =“添加”type =“button”title =“”name =“添加”data-toggle =“tooltip”data-placement =“bottom”data-bind =“click:$ parent.SaveAndCloseAddressPopup,Tooltip:$ parent.SaveAndCloseAddressPopup”data-original-title =“保存更改并关闭”

0
driver.findElement(By.id("AddressLine1")).sendKeys("plot no-23"); 
this try this 
driver.findElement(By.id("Address")).sendKeys("plot no-23"); 

为您的示例代码段的输入框是

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="" 

在这里你可以清楚地看到,输入标签的ID是地址不AddressLine1

+0

这是我的错误在编辑其编号为“AddressLine1” – Eknath

+0

好的请发布确切的html源代码,否则它变得非常困难,任何人都可以给你正确的答案 –

+0

这是html代码文本框1 Eknath

相关问题