Search code examples
asp.netwatin

WatiN - getting past the certificate error page


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.


Solution

  • 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();
    }