如何使用华廷IE处理Windows安全警报对话框 [英] How to handle Windows Security alert dialog box using Watin IE

查看:225
本文介绍了如何使用华廷IE处理Windows安全警报对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用自动化IE华廷网站。 由于该网站禁止几个请求后,IP。所以我设置一个布尔ipbanned =真实的,当IP被bannned。在这种情况下,我希望更改IP。该SetProxy方法成功地改变了IP联系地址与端口。 但下一个请求,我得到这个屏幕: -

I am trying to automate a website using WatIN IE. As the website bans the ip after few request .So I am setting a bool ipbanned =true when ip gets bannned. In that case and i wish to change the IP. The SetProxy method successfully changes the ip adress with port. but on next request I am getting this screen :-

注: - 第一个红色条状显示IP地址,第二个显示的服务器名称

Note: - the first red strip shows the ip address and the second one shows the server name

我应该如何设置在此对话框中的用户名和密码的程序中,这样用户就不会看到这个框,并设置正确

How should I set the username and password in this dialog box from within the program, so that user do not get to see this box and it is set correctly

下面是我使用的code片断: -

Below is the code snippet I am using:-

    private void Start_Thread()
    {
        Thread pop = new Thread(populate);
        pop.SetApartmentState(ApartmentState.STA);
        pop.Start();

    }
    bool ipbanned=false;
    private void populate()
    {

            if(ipbanned)
                SetProxy(proxies[0]);

           ///I wish to handle the dialog box here.

            WatiN.Core.Settings.MakeNewIeInstanceVisible = false;
            WatiN.Core.Settings.Instance.AutoMoveMousePointerToTopLeft = false;
            using (IE browser = new IE(URLs.mainurl))
            {
                    ///code
            }
    }
    private void SetProxy(string proxy)
    {
        //code which successfully changes the ip address.

    }

任何帮助会深深AP preciated。 谢谢您:)

Any help will be deeply appreciated. Thank You :)

推荐答案

您必须使用 AddDialogHandler 以处理对话框。

You have to use AddDialogHandler to handle the dialog boxes.

您可以参考的SO问题<一href="http://stackoverflow.com/questions/2841120/watin-logondialoghandlers-not-working-correctly-in-windows-7">watin-logondialoghandlers-not-working-correctly-in-windows-7为code样品

You can refer the SO question watin-logondialoghandlers-not-working-correctly-in-windows-7 for code samples

这篇关于如何使用华廷IE处理Windows安全警报对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆