views:

580

answers:

2

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:

http://stackoverflow.com/questions/1391718/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"); 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.

A: 

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

AutomatedTester
any idea which selenium IDE commands to use?
I don't understand your question. I thought you wanted help with Selenium RC. Do you want help with RC or IDE?
AutomatedTester
I was initially using IDE but I have switched to Selenium RC. I tried your suggestion in another area and am still getting an error message. I posted the code in the answer below (since it did not fit here)
A: 
selenium.Click("ctl00_page_content_btnProceed");
            for (int second = 0; ; second++)
            {
                if (second >= 60) Assert.Fail("timeout");
                try
                {
                    if (selenium.IsElementPresent("ctl00_page_content_chkEligibleEmployee_1")) break;
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            selenium.Click("ctl00_page_content_chkEligibleEmployee_1");
            Assert.IsFalse(selenium.IsEditable("ctl00_page_content_chkEligibleEmployee_0"));


            selenium.Click("ctl00_page_content_btnNewReceipients");


            selenium.Click("ctl00_page_content_ExistingShiftDetails_ctl03_linkbtnShowHide");
            Assert.IsTrue(Regex.IsMatch(selenium.GetConfirmation(), "^Are you sure you want to send this shift to newly added recipient(s)?[\\s\\S]$"));

Still getting the unexpected confirmation error.

You should just edit your question if you want to add new info rather than editing it.Other than that which line is throwing the confirmation error?
AutomatedTester