Exemplo n.º 1
0
        /// <summary>
        /// 出价 -
        /// 1. 输入价格 - 移动到输入框位置,点击,清空历史数据,输入新价格
        /// 2. 点击出价按钮 - 移动到按钮位置,点击
        /// 3. 对验证码区域截图 且 上传
        /// </summary>
        public void OfferPrice(int targetPrice, bool enableCancelFirst, Func <CaptchaAnswerImage, bool> callbackFunc = null)
        {
            // 0. 出价前,先尝试取消,防止上一步的可能的遮罩
            if (enableCancelFirst)
            {
                // this.CancelOfferedPrice();
                actionManager.ClickButtonByFenceWayRToL(actionManager.AddDelta(742, 502));
            }

            // 1. 输入价格 且 出价
            // TODO: 坐标方法 - 应该抽取出来单独管理
            actionManager.InputTextAtPoint(actionManager.AddDelta(676, 417), targetPrice.ToString(), true, "第二阶段出价");
            actionManager.ClickButtonAtPoint(actionManager.AddDelta(800, 415), true, "第二阶段出价");

            // 2. 对验证码区域截屏且上传
            // 这里尝试异步
            ThreadUtils.StartNewTaskSafe(() =>
            {
                // 这里等待会阻塞进程
                KK.Sleep(390);
                CaptchaAnswerImage img = CaptureCaptchaImage();
                UploadCaptchaImage(img);

                callbackFunc?.Invoke(img);
            }
                                         );


            // return img;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 出价 -
        /// 1. 输入价格 - 移动到输入框位置,点击,清空历史数据,输入新价格
        /// 2. 点击出价按钮 - 移动到按钮位置,点击
        /// 3. 对验证码区域截图 且 上传
        /// </summary>
        public CaptchaAnswerImage OfferPrice(int targetPrice, bool enableCancelFirst, bool needUploadCaptchaTask = false)
        {
            // 0. 出价前,先尝试取消,防止上一步的可能的遮罩
            if (enableCancelFirst)
            {
                actionManager.ClickButtonByFenceWayRToL(actionManager.AddDelta(742, 502));
            }

            // 1. 输入价格 且 出价
            actionManager.InputTextAtPoint(actionManager.AddDelta(676, 317), targetPrice.ToString(), true, "第一阶段出价#i1");
            actionManager.InputTextAtPoint(actionManager.AddDelta(676, 375), targetPrice.ToString(), true, "第一阶段出价#i2");
            actionManager.ClickButtonAtPoint(actionManager.AddDelta(800, 373), true, "第一阶段出价");

            // 2. 对验证码区域截屏且上传
            KK.Sleep(500);
            CaptchaAnswerImage img = CaptureCaptchaImage();

            UploadCaptchaImage(img);

            return(img);
        }
Exemplo n.º 3
0
        private void _LoginBidAccount(string bidNo, string password, string idCardNo, bool clickLoginButton)
        {
            // 登录页
            var p21 = actionManager.DeltaPoint(610, 168);
            var p22 = actionManager.DeltaPoint(610, 218);
            var p23 = actionManager.DeltaPoint(610, 264);

            actionManager.InputTextAtPoint(p21, bidNo, true, "投标号");
            KK.Sleep(KK.RandomInt(100, 500));

            actionManager.InputTextAtPoint(p22, password, true, "密码");
            KK.Sleep(KK.RandomInt(100, 500));

            // 可能需要输入身份证 - 身份证
            isIdCardShow = IsIdCardNeeded();
            if (isIdCardShow)
            {
                actionManager.InputTextAtPoint(p23, idCardNo, true, "身份证");
            }
            else
            {
                var p231 = actionManager.DeltaPoint(610, 256);
                actionManager.InputTextAtPoint(p231, idCardNo, true, "身份证");
            }

            KK.Sleep(KK.RandomInt(100, 500));

            //this.inputCaptchaAtLogin(p23, "301726");
            //this.clickLoginAtLogin(p24);
            if (clickLoginButton)
            {
                ClickLoginButton();
            }

            logger.InfoFormat("login account#{0} ", bidNo);
        }