基本信息
源码名称:模拟人工录入web银行站点密码
源码大小:9.15M
文件格式:.rar
开发语言:C#
更新时间:2020-09-14
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 20 元 
   源码介绍
针对安全控件,自动录入密码

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Threading;
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
using Keys = OpenQA.Selenium.Keys;

namespace 模拟密码录入
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            #region MyRegion

            InternetExplorerOptions option = new InternetExplorerOptions();
            option.IgnoreZoomLevel = false;
            option.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
            option.PageLoadStrategy = PageLoadStrategy.Eager;
            option.RequireWindowFocus = false;

            #endregion

            var service = InternetExplorerDriverService.CreateDefaultService();
            service.HideCommandPromptWindow = true;
            IWebDriver driver = new InternetExplorerDriver(service, option);
            driver.Manage().Window.Maximize();
            testInput(driver);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="driver"></param>
        public static void testInput(IWebDriver driver)
        {
            try
            {
                string url = "https://www.cebbank.com/cebent/prelogin.do?_locale=zh_CN";
                driver.Navigate().GoToUrl(url);

                try
                {

                    IWebElement webElement = driver.FindElement((By.LinkText("详细信息")));
                    if (webElement != null)
                    {
                        webElement.Click();
                    }

                    webElement = driver.FindElement((By.LinkText("转到此网页(不推荐)")));
                    if (webElement != null)
                    {
                        webElement.Click();
                    }

                }
                catch
                {

                }
                IWebElement element = driver.FindElement(By.XPath("//*[@id='CifNo']"));
                element.SendKeys("0000000000");

                element = driver.FindElement(By.XPath("//*[@id='UserId']"));
                element.SendKeys("000");

                element.SendKeys(Keys.Tab);
                HelperInput.KeyboardSimulateInputString("00000000", false, 600);


                element = driver.FindElement(By.XPath("//*[@id='Confirm']"));
                element.Click();

            }

            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                Thread.Sleep(6000);
            }
        }
    }
}