Beispiel #1
0
        void dialog_OkButtonClick(object sender, EventArgs e)
        {
            ValidateCodeDialog d     = sender as ValidateCodeDialog;
            TextField          input = myBrowser.TextField(Find.ById("code"));

            input.TypeText(d.ValidateCode);
        }
Beispiel #2
0
        private void ShowDialog(IHTMLElement el)
        {
            cEXWB webBrowser = AppContext.Browser as cEXWB;

            if (webBrowser.InvokeRequired)
            {
                webBrowser.Invoke(new Action(Perform));
                return;
            }
            ValidateCodeDialog dialog = new ValidateCodeDialog(webBrowser, el);

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                InputValue = dialog.ValidateCode;
            }
        }
Beispiel #3
0
        public void ValidateCodeTest()
        {
            TestHelper.UIRun(
                (browser) =>
            {
                browser.GoTo("http://localhost/test/validateCodeTest.htm");
                myBrowser = browser;
            },
                () => {
                ValidateCodeDialog dialog = new ValidateCodeDialog(TestHelper.WB);
                dialog.OkButtonClick     += new EventHandler(dialog_OkButtonClick);
                dialog.Show(TestHelper.WB);

                TestHelper.MainForm.Activate();
                dialog.Activate();
            }
                );
        }
Beispiel #4
0
        public override void Perform()
        {
            cEXWB webBrowser = AppContext.Browser as cEXWB;

            if (webBrowser.InvokeRequired)
            {
                webBrowser.Invoke(new Action(Perform));
                return;
            }
            bool exists = Window.Elements.Exists(GetConstraint());

            if (exists)
            {
                Element element = GetElement();
                //弹出对话框输验证码
                if (ValidateImage != null && !string.IsNullOrEmpty(ValidateImage.InputValue))
                {
                    TextToType = ValidateImage.InputValue;
                    base.Perform();
                }
                else if (IsMobileValidate)
                {
                    ValidateCodeDialog dialog = new ValidateCodeDialog(webBrowser);
                    dialog.Activate();
                    dialog.WindowState = System.Windows.Forms.FormWindowState.Normal;
                    if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        if (!string.IsNullOrEmpty(dialog.ValidateCode))
                        {
                            TextToType = dialog.ValidateCode;
                            base.Perform();
                        }
                    }
                }
                else //在浏览器里面输验证码
                {
                    //var nativeElement = element.NativeElement as IEElement;
                    //nativeElement.AsHtmlElement.scrollIntoView();
                    //webBrowser.WBKeyDown -= new WBKeyDownEventHandler(webBrowser_WBKeyDown);
                    //webBrowser.WBKeyDown += new WBKeyDownEventHandler(webBrowser_WBKeyDown);
                    //this.Breakpoint = BreakpointIndicators.ActiveBreakpoint;
                }
            }
        }
Beispiel #5
0
        public void ValidateCodeTest()
        {
            ValidateCodeDialog cd = new ValidateCodeDialog();

            Application.Run(cd);
        }