/// <summary> /// 模拟点击输入保存 /// </summary> public void ClickAndInPut() { if (detailsList.Count > 0) { int timesYzm = 0; #region 需要变动的三个值 MouseClick(325, 175);//来源 MouseClick(280, 240); MouseClick(410, 210);//申请人 SendKeys.SendWait("坤"); Thread.Sleep(500); MouseClick(690, 210);//电话 SendKeys.SendWait("020"); Thread.Sleep(500); MouseClick(780, 210); SendKeys.SendWait("83748494"); Thread.Sleep(500); #endregion for (int i = 0; i < detailsList.Count; i++) { LeftMouseClick(410, 138, 2);//公司 User32API.Keybd_event(VirtualKey.BACK, 0, KeyEvent.KEYEVENTF_EXTENDEDKEY, 0); SendKeys.SendWait(detailsList[i]); //SendKeys.SendWait("{BACKSPACE}"); while (GetPixs())//判断是否有验证码,存在则调用验证码识别接口,并点击输入 { if (timesYzm >= 2) { MessageBox.Show("验证码已经输错两次,为确保不被封号,请自行输入正确验证码后点击确认!", "警告"); Thread.Sleep(1000 * 2); break; } string yzmPath = basePath + "yzm.png"; Bitmap bitmap = new Bitmap(yzmPath); string yzm = yzmDistinguish(bitmap); LeftMouseClick(435, 610, 2);//验证码 User32API.Keybd_event(VirtualKey.BACK, 0, KeyEvent.KEYEVENTF_EXTENDEDKEY, 0); SendKeys.SendWait(yzm); MouseClick(348, 596);//保存 if (GetPixs()) { timesYzm++; continue; } else { break; } } MouseClick(348, 596);//保存 Thread.Sleep(1000); MouseClick(668, 340); } } KillProcess("firefox"); }