This is a migrated thread and some comments may be shown as answers.

Can't view elements of Modal HTML Popup

5 Answers 181 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
wilfredo
Top achievements
Rank 1
wilfredo asked on 14 Jun 2011, 07:48 AM
Have an link that will open an modal popup which is html. First thing is that i can't assert if the window is ready via pagetitle which is my first problem. Maybe if i can solve the first problem then maybe that's the time i can access the elements on it.

By the way, the html pop up contains , dropdownlist, okay(image) and cancel(image) which are all clickable.

Need your help.. Can't find any relate problem here that's why i started new thread. I also did read the documentation about the HTML Pop-up which i think it's not the same on mine but did the steps stated there but there's no luck.

5 Answers, 1 is accepted

Sort by
0
Accepted
Stoich
Telerik team
answered on 21 Jun 2011, 01:11 PM
Hello Wilfredo,
     I was not able to reproduce this issue. Below is the code I used against the modal pop-up seen on this page:
http://www.codestore.net/store.nsf/unid/DOMM-4R5MDQ
It works correctly.

// Launch an instance of the browser
        Manager.LaunchNewBrowser();
 
        // Navigate to : 'http://www.codestore.net/store.nsf/unid/DOMM-4R5MDQ'
        ActiveBrowser.NavigateTo("http://www.codestore.net/store.nsf/unid/DOMM-4R5MDQ");
 
        // Click 'ThisLinkLink'
        ActiveBrowser.Window.SetFocus();
        HtmlAnchor a = Find.ByContent<HtmlAnchor>("this link");
        a.ScrollToVisible(ArtOfTest.WebAii.Core.ScrollToVisibleType.ElementTopAtWindowTop);
        a.MouseClick();
        System.Threading.Thread.Sleep(1000);
 
        // Connect to modal pop-up window : A Modal Pop-Up -- Webpage Dialog
        if ((ActiveBrowser.BrowserType == BrowserType.InternetExplorer))
        {
            ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions ieActions = ((ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions)(ActiveBrowser.Actions));
            ieActions.ConnectIEDialog("A Modal Pop-Up -- Webpage Dialog", 5000);
        }
        Manager.WaitForNewBrowserConnect("http://www.codestore.net/store.nsf/unid/9F0D8552077A408686256999005AC70D/$file/si" +
                        "mple.html", true, 5000);
        Manager.ActiveBrowser.WaitUntilReady();
        Log.WriteLine(Manager.ActiveBrowser.PageTitle);
 
        // Click 'ThisIsInADiv'
        Find.ByContent<HtmlDiv>("This is in a modal dialogue. Use the X button to return to the main window.").MouseClick();
 
        // Close modal pop-up window : A Modal Pop-Up -- Webpage Dialog
        ActiveBrowser.Close();

Regards,
Stoich
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Saket
Top achievements
Rank 1
answered on 13 Sep 2011, 01:50 PM
Hi ,

I am using the same snippet to connect to the modal dialog however the time taken to connect to the new modal dialog opened is so large that the application actually times out.
I could see the modal dialog open and the focus on the required feild in the dialog but the code breakpoint is not hit
any clue...
help appreciated
0
Stoich
Telerik team
answered on 14 Sep 2011, 02:27 PM
Hi Saket,
    try increasing the timeouts in the code. The following lines:
ieActions.ConnectIEDialog("A Modal Pop-Up -- Webpage Dialog", 5000);
                        "mple.html", true, 5000);
should have their respective timeout bumped up:
ieActions.ConnectIEDialog("A Modal Pop-Up -- Webpage Dialog", 60000);
 
                        "mple.html", true,60000);

This might do the trick. Let me know how it goes.

Best wishes,
Stoich
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Toldo
Top achievements
Rank 1
answered on 06 Sep 2012, 02:12 PM
Hello,

I am able to connect to modal dialogs opened in my tests. But I always need to do a MouseClick() instead of invoking onclick() event on the element with Click(true) for instance. Otherwise test will stuck on the click step.

I am sure it is known issue since you also use the workaround in you samples. I just would like to know whether it is planned to be fixed in nearest future in order to allow opening Modal dialogs with JS when browser window is in background.

Thank you in advance.
0
Cody
Telerik team
answered on 11 Sep 2012, 10:45 PM
Hello Toldo,

We do not consider this behavior to be a bug that needs to be fixed. The problem is that when we send OnClick to the browser, the browser will not return control back to Test Studio until the popup modal window is closed.

Regards,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
wilfredo
Top achievements
Rank 1
Answers by
Stoich
Telerik team
Saket
Top achievements
Rank 1
Toldo
Top achievements
Rank 1
Cody
Telerik team
Share this question
or