1

我正在尝试从表中删除用户。起初我收到超时错误,但使用了 BeatnicClick() ,如下所述:

Selenium IDE click() 超时

这解决了超时错误,但我仍然收到意外的确认错误。以下是部分源代码:

selenium.Click("ctl00_btnAddressBook"); selenium.WaitForPageToLoad("30000");

// selenium.BeatnicClick("ctl00_page_content_ExistingEmployees_ctl03_btnDeleteEmployee");

String 您确定要删除选定的项目吗?= selenium.GetConfirmation();

任何帮助,将不胜感激。提前致谢。

4

1 回答 1

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?"));

这应该点击删除元素,然后得到确认,如果你想要它可以断言它的正确消息

于 2010-01-18T15:59:03.053 回答