Download Dialogue handling doesn't work proper in Firefox and Safari

9 posts, 0 answers
  1. Thomas Temme
    Thomas Temme avatar
    3 posts
    Member since:
    Dec 2009

    Posted 21 Oct 2010 Link to this post

    Hello,

    unfortunately the Download Dialogues aren't handled proper within my Application. Here is a code snippet:

    Settings mySettings = new Settings(BrowserType.FireFox, @"C:\browserlog\");
                Manager myManager = new Manager(mySettings);
                myManager.Start();
                myManager.LaunchNewBrowser();
                myManager.ActiveBrowser.NavigateTo("http://www.c-c-center.de/nuetzliches/exceluebungen/index.htm");
                myManager.ActiveBrowser.Find.ByContent<HtmlControl>("x:Kunden.xls").Download(false,DownloadOption.Save,"C:\\test.xls",5000);
    With this, the Firefox open dialogue pops up for a short moment and then disappears. After five seconds I get the TimeoutException. In the log file stands this line:
    "Unexpected dialog encountered. Closing the dialog, and halting execution".

    I've also tried this code with the same result:

    Settings mySettings = new Settings(BrowserType.FireFox, @"C:\browserlog\");
    Manager myManager = new Manager(mySettings);
    myManager.Start();
    myManager.LaunchNewBrowser();
    Element elem = myManager.ActiveBrowser.Find.ByContent("x:Kunden.xls");
    string saveLocation = "C:\\test.xls";
    DownloadDialogsHandler handler = new DownloadDialogsHandler(myManager.ActiveBrowser, DialogButton.SAVE, saveLocation, myManager.Desktop);
    myManager.ActiveBrowser.Actions.Click(elem);
    handler.WaitUntilHandled(5000);

    After calling "handler.WaitUntilHandled" the Open Dialogue disappears and after five seconds I get the TimeOutException.

    The same problem occurs with Safari. I've also checked my Firefox configuration and configured it this way, but it didn't help:
    http://www.artoftest.com/support/webaii/topicsindex.aspx?topic=configurefirefox2x3x

    Do you have any idea what's wrong? I've attached my Firefox Open Dialogue.

    I would really appreciate your help.

    Many thanks
    Thomas
  2. Jie Liang
    Jie Liang avatar
    4 posts
    Member since:
    Apr 2010

    Posted 01 Nov 2010 Link to this post

    I got the same problem when handling the Open dialog.
  3. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 01 Nov 2010 Link to this post

    Hello Jie Liang,

    The screen shot you provide shows a non-English dialog box. Unfortunately at this time we do not support non-English dialog handling for Firefox and Safari. We only support non-English file handling dialogs in IE 7 or IE 8. Also recommend using IE 8 for non-English. Our dialog handling works better in IE 8 due to differences in the browser.

    Kind regards,
    Cody
    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
  4. Jie Liang
    Jie Liang avatar
    4 posts
    Member since:
    Apr 2010

    Posted 02 Nov 2010 Link to this post

    Hello,

    My code:

    FileUploadDialog uploadDialog = new FileUploadDialog(Manager.ActiveBrowser, m_fileURI, DialogButton.OPEN, "Open");
    uploadDialog.HandlerDelegate = FileUploadDialogHanlder;
    Manager.DialogMonitor.AddDialog(uploadDialog);
    Manager.DialogMonitor.Start();
     
    Click(UIMaps.UIFileManagement.UIFileUploadDialog.UIBrowseButton);
     
    uploadDialog.WaitUntilHandled();
    Manager.DialogMonitor.RemoveDialog(uploadDialog);
    Manager.DialogMonitor.Stop();
    m_fileURI = null;

    And the FileUploadDialogHandler:
    private void FileUploadDialogHanlder(IDialog dialog)
    {
        Manager.Desktop.KeyBoard.TypeText(m_fileURI, 200);
        dialog.HandlerDelegate = null;
    }

    The Framework version is 2010.2.713.0, but it got the same problem in 2010.2.830.

    The Problem is very similar to Thomas's. After the Open dialog shows up, it disappears in a few seconds.

    I am using Firefox and my system language is English. But I can't try it in IE because for some reason the framework can't find the Silverlight app in IE.

    Hope the above info can help you diagnose the problem.

    Thanks,

    Jie
  5. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 05 Nov 2010 Link to this post

    Hello Jie Liang,

    I don't see the need for:

    uploadDialog.HandlerDelegate = FileUploadDialogHanlder;

    The FileUploadDialog object will automatically enter the correct filename for you. Please try removing this line of code.

    I suspect the real problem you're having is a new feature we added to the framework. Try adding this line of code at the beginning of your test:

    Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;

    For your Silverlight app problem in IE, the most common problem is the .XAP file type is not correct registered in IIS as documented here.


    Regards,
    Cody
    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
  6. Jie Liang
    Jie Liang avatar
    4 posts
    Member since:
    Apr 2010

    Posted 08 Nov 2010 Link to this post

    Hi Cody,

    Many thanks for your reply! I've made my test connected to our Silverlight app in IE.

    However, I added the line of code suggested by you. And I can see that it doesn't close the File Open Win32 dialog after a few second anymore. However, it doesn't enter the URL specified in the constructor. The File Open dialog will remain open until uploadDialog.WaitUntilHandled() times out.

    Here are my modified codes:
    /// <summary>
    /// Initialization for each test.
    /// </summary>
    [SetUp]
    public void MyTestInitialize()
    {
        #region WebAii Initialization
     
        Settings settings = GetSettings();
        settings.EnableSilverlight = true;
        settings.DefaultBrowser = m_config.Type;
        settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
     
        // Now call Initialize again with your updated settings object
        Initialize(settings, new TestContextWriteLine(TestContext.Out.WriteLine));
     
        #endregion
     }

    And the steps to open the Win32 File Open dialog:
    if (m_fileURI != null)
    {
        FileUploadDialog uploadDialog = new FileUploadDialog(ActiveBrowser, m_fileURI, DialogButton.OPEN);
        Manager.DialogMonitor.AddDialog(uploadDialog);
        Manager.DialogMonitor.Start();
     
        Click(UIMaps.UIFileManagement.UIFileUploadDialog.UIBrowseButton);
     
        uploadDialog.WaitUntilHandled(); //times out here
        Manager.DialogMonitor.RemoveDialog(uploadDialog);
        Manager.DialogMonitor.Stop();
        m_fileURI = null;
    }

    I am using the  2010.2.830.0 Framework in IE8. Please help me again! I feel I am only one step away from the final solution :)

    Thanks,

    Jie
  7. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 09 Nov 2010 Link to this post

    Hello Jie Liang,

    Yes that looks like it should work just fine. Would you mind sending me your test project? I'd like the chance to review the entire code instead of just small portions of it. You can place the project folder into a .zip file and attach it (don't forget to click Attach Files after selecting the file to upload).

    Best wishes,
    Cody
    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
  8. Jie Liang
    Jie Liang avatar
    4 posts
    Member since:
    Apr 2010

    Posted 11 Nov 2010 Link to this post

    Hi Cody,

    Thanks for your reply!

    I am unable to send you the entire test project, but I put the codes into a nunit test.

    The file is modified from C:\Program Files\Telerik\WebAii Testing Framework 2010.3\Samples\WebAii Framework\QuickStarts_NUnit_CS\Tests\SilverlightHealthCareSample.cs .

    The test timeout at:
    uploadDialog.WaitUntilHandled();

    In the Silverlight app, the implementation of clicking "browseButton" is very simple:
    private void browseForFileClick(object sender, RoutedEventArgs e)
            {
                m_dlg = new OpenFileDialog();
                bool? retval = m_dlg.ShowDialog();

    I am using Framework 2010.3.1109 .

    Please help!

    Thank you,

    Jie
  9. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 16 Nov 2010 Link to this post

    Hi Jie Liang,

    Uploading in Firefox does work for HTML pages. Here's a complete working sample test that demonstrates how to write the code to do file uploading in Firefox. I hope you can model your code after this:

    [TestMethod]
    public void UploadDemoTest()
    {
        Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
     
        Manager.LaunchNewBrowser(BrowserType.FireFox);
        ActiveBrowser.NavigateTo("http://cgi-lib.berkeley.edu/ex/fup.html");
     
        FileUploadDialog upDlg = new FileUploadDialog(ActiveBrowser, @"C:\Users\gibson\Pictures\ArtOfTest_Logo.png", DialogButton.OPEN);
        Manager.DialogMonitor.AddDialog(upDlg);
        Manager.DialogMonitor.Start();
     
        Find.ByName<HtmlInputFile>("upfile").MouseClick();
     
        upDlg.WaitUntilHandled(30000);
     
        Find.ByAttributes<HtmlInputSubmit>("value=Press").Click();
     
        ActiveBrowser.WaitForUrl("http://cgi-lib.berkeley.edu/ex/fup.cgi", false, 5000);
    }

    I don't have a Silverlight application I can use for testing. I did look at you code and it seems to be all right to me. I'll have to see your application in action to understand what/where the problem is.

    Greetings,
    Cody
    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
Back to Top