This is a migrated thread and some comments may be shown as answers.
Problems with Confirmdialog when clicked on a anchor
4 Answers 44 Views
This is a migrated thread and some comments may be shown as answers.
Patrik
Top achievements
Rank 1
Patrik asked on 24 Feb 2011, 09:53 AM
Hi
I'm using webaii 2010.3.1421.0 and trying to handle a javascript Confirmdialog. 
First I used a button element as button and everything worked OK, but I had replace the button with an anchor and the the dialog handling stopped working.

The result after the change to an anchor is that the dialog popsup but after that nothing happends, the execution stop after the Find and Click statement.
Tested using Chrome, and it works with this, but when I'm using Firefox or Internet Explorer. When I'm using Chrome my FindByContent stops to work. :(


The code for handling the ConfirmDialog
public void ClickAcceptButton(DialogButton clickButton)
{
    var confirmDialog = new ConfirmDialog(TestContext.ActiveBrowser, clickButton);
    TestContext.Manager.DialogMonitor.AddDialog(confirmDialog);
    TestContext.Manager.DialogMonitor.Start();
             
    Find.ById<HtmlAnchor>("accept").Click(false); //this was Find.ById<HtmlInputButton>("accept").Click(false);
    confirmDialog.WaitUntilHandled(5000);
                        
    TestContext.Manager.DialogMonitor.Stop();
}

HTML
<a href='#' id='accept'>
    <span class='button-green'>Accept</span>
</a>



Thanks in advance!

4 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 02 Mar 2011, 12:49 AM
Hi Patrik,

The code looks right to me for a standard Confirm dialog. Can you show me the JavaScript that launches your confirm dialog? I don't see that in the HTML snippet you posted. How does it get activated?

You state "the execution stop after the Find and Click statement"... does it actually hang there permanently or does it timeout and error out after the 5 second delay you have coded in your WaitUntilHandled line of code?

Kind regards,
Cody
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Patrik
Top achievements
Rank 1
answered on 03 Mar 2011, 10:48 AM
Hi

Found out that the problem was not related to webaii. I upgraded an addin to visual stuido at the same time I did the change and it was that which caused the error.

/patrik
0
Mahendra Kumar
Top achievements
Rank 1
answered on 28 Nov 2011, 11:39 AM
Hi Patrik,

Can you please let me what exactly you did to fix that issue, since I am also running into similar kind of issue with firefiox.

Thanks in advance,
Mahendra
0
Anthony
Telerik team
answered on 01 Dec 2011, 05:17 PM
Hello Mahendra Kumar,

Can you provide more detail on the exact error you're getting? Please also include your dialog handling code and the HTML you're testing against. Even better, if the site you're testing is publicly accessible, provide the link so we can run your code for ourselves and see the issue first-hand. 

Greetings,
Anthony
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Patrik
Top achievements
Rank 1
Answers by
Cody
Telerik team
Patrik
Top achievements
Rank 1
Mahendra Kumar
Top achievements
Rank 1
Anthony
Telerik team
Share this question
or