我正在尝试从表中删除用户。起初我遇到了超时错误,但使用了BeatnicClick(),如下所述:
解决了超时错误,但我仍然收到意外的确认错误。这是源代码的一部分:
selenium.Click( “ctl00_btnAddressBook”); selenium.WaitForPageToLoad( “30000”);
// selenium.BeatnicClick(“ctl00_page_content_ExistingEmployees_ctl03_btnDeleteEmployee”);
String您确定要删除吗? 所选项目? = selenium.GetConfirmation();
任何帮助将不胜感激。提前谢谢。
答案 0 :(得分:2)
要处理确认代码应该是
selenium.Click("ctl00_btnAddressBook");
selenium.WaitForPageToLoad("30000");
//the IDE code is to get around the IDE bug that it waits on click but it works in Se:RC
selenium.Click("ctl00_page_content_ExistingEmployees_ctl03_btnDeleteEmployee");
//handle the confirmation that appears after the click
string confirmMessage = selenium.GetConfirmation();
//Assert its the correct message
Assert.IsTrue(Regex.IsMatch(confirmMessage,"Are you sure you want to delete the selected item?"));
这应该点击删除元素然后得到确认,如果你想要它可以断言正确的消息