【问题标题】:Could not get Alert dialog with Firefox when using final WatiN version使用最终 WatiN 版本时无法通过 Firefox 获得警报对话框
【发布时间】:2011-03-08 02:06:28
【问题描述】:

下面的代码在 IE7 上运行良好,但是当我切换到使用 Firefox(从 3.0 到 3.6)运行时,我无法获得对话框。它在线引发错误: DiaglogHandler.WaitUntilExists(10) “对话在 10 秒内不可用。”即使对话框在那里。我正在使用最终的 WatiN 版本。

        string url = "https://www.xxx.com"
        Settings.AutoStartDialogWatcher = true;
        Settings.AutoCloseDialogs = false;
        //var browser = new IE();
        var browser = new FireFox();
        browser.GoTo(url);
        Image theButton = browser.Image(Find.By("id", "button"));
        AlertDialogHandler DiaglogHandler = new AlertDialogHandler();

        DialogWatcher theDialogWatcher = new DialogWatcher(new WatiN.Core.Native.Windows.Window(browser.hWnd));
        theDialogWatcher.Add(DiaglogHandler);
        theDialogWatcher.CloseUnhandledDialogs = false;

        theButton.ClickNoWait();

        DiaglogHandler.WaitUntilExists(10);
        Console.WriteLine(DiaglogHandler.Message);

        Console.WriteLine("Done");
        Console.ReadLine();

【问题讨论】:

    标签: firefox dialog watin


    【解决方案1】:

    Afaik WatiN 还不能很好地处理对话框,尽管它即将出现。

    可以绕过它们,比如将 Enter 传递给浏览器或其他 javascript 交互。

    Authentication Required Dialogs in FireFox 我也遇到过类似的问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-08
      • 2021-01-17
      相关资源
      最近更新 更多