WatiN - 绕过证书错误页面

发布于 2024-08-13 20:17:18 字数 397 浏览 2 评论 0原文

有人知道如何在 WatiN 中使用 CertificateWarningHandler 吗?

我已经...

IE ie = new IE("https://mysite.aspx");

CertificateWarningHandler cwh = new CertificateWarningHandler(CertificateWarningHandler.ButtonsEnum.Yes);
cwh.HandleDialog(new Window(ie.hWnd));

...这完全没有任何作用。

更一般地说,你们到底是如何使用这个工具的?该文档几乎毫无用处,而且网上似乎没有任何像样的资源。我肯定漏掉了一些东西,因为我花了大约半个小时才写了 3 行根本不起作用的代码。

Anyone know how to use CertificateWarningHandler in WatiN?

I've got as far as...

IE ie = new IE("https://mysite.aspx");

CertificateWarningHandler cwh = new CertificateWarningHandler(CertificateWarningHandler.ButtonsEnum.Yes);
cwh.HandleDialog(new Window(ie.hWnd));

... which does precisely nothing.

On a more general note, how on earth do you people manage to use this tool? The documentation is nearly useless, and there doesn't seem to be any decent resource online. I must be missing something because it's taken me about half an hour to write 3 lines of code that don't even work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

清风挽心 2024-08-20 20:17:18

我使用的东西类似于萨尔正在使用的东西,它工作得很好(我的测试是跨浏览器的)。

//覆盖浏览器中的安全警告
{

                if (Browser.Link(Find.ById("overridelink")).Exists)
                {
                    Browser.Link(Find.ById("overridelink")).Click();
                    Browser.WaitForComplete();
                }
                else
                {
                    Browser.WaitForComplete();
                }   //end else
            }

我不是开发人员,但我发现有大量关于 WatiN 和其他帖子代码示例之类的信息,这些信息确实很有帮助。在寻求 WatiN 帮助方面,Google 是我最好的朋友之一。你会掌握窍门的。

I'm using something similar to what Saar is using and it works fine (my tests are cross-browser).

//Override security warning in browser
{

                if (Browser.Link(Find.ById("overridelink")).Exists)
                {
                    Browser.Link(Find.ById("overridelink")).Click();
                    Browser.WaitForComplete();
                }
                else
                {
                    Browser.WaitForComplete();
                }   //end else
            }

I'm not a developer, and I've found that there's plenty of information out there on WatiN and others post code samples and the like that are really helpful. Google is one of my best friends when it comes to finding WatiN help. You'll get the hang of it.

卖梦商人 2024-08-20 20:17:18

你已经尝试过关注了吗?

ie.DialogWatcher.Add(cwh);

或者只是

ie.DialogWatcher.Add(new CertificateWarningHandler());

更新:评论后。

实际上这对我有用。
进一步可能会有所帮助

Browser browser = ie;
 if (browser.Links.Exists("overridelink"))
{
       browser.Link("overridelink").Click();
}

have you tried following already?

ie.DialogWatcher.Add(cwh);

or just

ie.DialogWatcher.Add(new CertificateWarningHandler());

Update: After comment.

Actually this works for me.
further may be following will help

Browser browser = ie;
 if (browser.Links.Exists("overridelink"))
{
       browser.Link("overridelink").Click();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文