I am trying to delete a user from a table. At first I was getting a timeout error but used the BeatnicClick() as described here:
Selenium IDE click() timeout
That solved the timeout error but I'm still getting the unexpected confirmation error. Here's part of the source code:
selenium.Click("ctl00_btnAddressBook&qu开发者_开发问答ot;); selenium.WaitForPageToLoad("30000");
// selenium.BeatnicClick("ctl00_page_content_ExistingEmployees_ctl03_btnDeleteEmployee");
String Are you sure you want to delete the selected item? = selenium.GetConfirmation();
Any help would be appreciated. Thanks in advance.
To handle the confirmation your code should look like
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?"));
This should click on the delete element and then get the confirm and if you want it can assert its the correct message
精彩评论