Esempio n. 1
0
        // 获取手机号码,并填入网页中
        private string EnterPhone()
        {
            string phoneNum = "";

            for (int i = 0; i < 5; i++)
            {
                phoneNum = SmsApi.GetPhone("2");
                if (string.IsNullOrEmpty(phoneNum) || phoneNum == "未获取到号码")
                {
                    LogManager.WriteLog("未获取到号码,等待5秒钟");
                    Thread.Sleep(5000);
                }
                else
                {
                    break;
                }
            }
            new Thread(() => {
                string js2run =
                    "document.getElementById('J_PhoneInput').value = '{0}';".With(phoneNum) +
                    "document.getElementsByClassName('btn-b tsl')[1].click();";
                CefFrameHelper.ExcuteJs(_mfForm.MainCefFrame, js2run);
                LogManager.WriteLog("{0} is fill ".With(phoneNum));
            }).Start();
            Thread.Sleep(2000);
            Application.DoEvents();
            TB_TB_TELNUM.Text = phoneNum;
            return(phoneNum);
        }
Esempio n. 2
0
        public void BT_ZFB_REG_TB_REG_SJ_Click(object sender, EventArgs e)
        {
            //1.login
            SmsConfigHelper.GetConfigOfSms();
            if (!SmsApi.logined)
            {
                LogManager.WriteLog("登录失败");
                return;
            }
            //2.
            TB_ZFB_REG_TB_ShouJi.Text = SmsApi.GetPhone("2");

            string js2run =
                "document.getElementById('J_PhoneInput').value = '{0}';".With(TB_ZFB_REG_TB_ShouJi.Text.Trim()) +
                "document.getElementsByClassName('btn-b')[0].click();";

            CefFrameHelper.ExcuteJs(_mfForm.MainCefFrame, js2run);

            Application.DoEvents();
            new Thread(() => {
                Thread.Sleep(2000);
                BT_ZFB_REG_TB_SMS_ENTERVCODE_Click(sender, e);
            }).Start();
            //    BT_ZFB_REG_TB_SMS_ENTERVCODE_Click(sender, e);
        }
Esempio n. 3
0
        private void FindTitleAndLoadHrefByJS(string p)
        {
            string js2run =
                "var hrefLinks=document.getElementsByTagName('a');" +
                "for(var i=0;i<hrefLinks.length;i++){ " +
                "if(hrefLinks[i].innerHTML=='" + p + "'){" +
                "hrefLinks[i].click();break;}}";

            CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
        }
Esempio n. 4
0
        public void SearchOneItem(object sender, LoadEndEventArgs eventHandler)
        {
            string searchKeys = FileHelper.read("config/searchkeysV2.txt")[shoppingIndex - 1]; //RandomManager.RandomReadOneLine("config/searchkeys.txt");
            var    keysArry   = searchKeys.Split('|');
            var    key        = keysArry[RandomManager.random.Next(0, keysArry.Count())];

            LogManager.WriteLog(key);
            string js2run = beforejs +
                            "mydoc.getElementById('inp-search-index').value='{0}';".With(key) +
                            "mydoc.getElementsByClassName('bton-search')[0].click();";

            CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
        }
Esempio n. 5
0
        private void BT_ZFB_REG_TB_SMS_ENTERVCODE_Click(object sender, EventArgs e)
        {
            string res = "";
            bool   isRevicedSmsCode = false;

            LogManager.WriteLog("msgAutoResetEvent 阻塞");
            msgAutoResetEvent.Reset();
            new Thread(() => {
                for (int i = 0; i < 5; i++)
                {
                    Thread.Sleep(3000);
                    res = SmsApi.GetMessage("2", TB_ZFB_REG_TB_ShouJi.Text);
                    //您于2014年05月11日申请了手机验证,校验码是295768。如非本人操作,请拨0571-88158198【淘宝网】
                    if (!string.IsNullOrEmpty(res) && res.Contains("校验码是"))
                    {
                        isRevicedSmsCode = true;
                        msgAutoResetEvent.Set();
                        LogManager.WriteLog("msgAutoResetEvent 释放");
                        break;
                    }
                }
                if (!isRevicedSmsCode)
                {
                    msgAutoResetEvent.Set();
                    LogManager.WriteLog("msgAutoResetEvent 释放.没有收到信息");
                }
            }).Start();


            LogManager.WriteLog("msgAutoResetEvent 等待");
            msgAutoResetEvent.WaitOne();
            LogManager.WriteLog("msgAutoResetEvent 继续");

            TB_SMS_MSG.Text = res;

            if (isRevicedSmsCode)
            {
                int    index1 = res.IndexOf("是") + 1;
                string num    = res.Substring(index1, 6);
                LBS_sms.Text      = num;
                TB_SMS_vcode.Text = num;
                string js2run =
                    "     document.getElementById('J_PhoneCheckCode').value='{0}';".With(TB_SMS_vcode.Text) +
                    "document.getElementsByClassName('btn-s')[0].click();";
                CefFrameHelper.ExcuteJs(_mfForm.MainCefFrame, js2run);
            }
            else
            {
                TB_SMS_MSG.Text = "没有收到验证码,耐心等等";
            }
        }
Esempio n. 6
0
        private void toolStripMenuItem18_Click(object sender, EventArgs e)
        {
            CefFrameHelper.ExcuteJs(MainCefFrame, "document.getElementById('J-input-user').value='{0}';".With(currentHaoZi.zfbEmail));
            new Thread(() => {
                Thread.Sleep(3000);
                MouseKeyBordHelper.POINT p1;
                MouseKeyBordHelper.GetCursorPos(out p1);

                LogManager.WriteLog("鼠标位置 {0},{1}   ".With(p1.X, p1.Y));

                LogManager.WriteLog("程序界面位置 {0},{1}   ".With(this.Left, this.Top));

                LogManager.WriteLog("边距 {0},{1}   ".With(p1.X - this.Left, p1.Y - this.Top));
                //point 596,406
                //Form 469,172


                Thread.Sleep(1000);

                int chax = 123;
                int chay = 232;
                MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay);

                Thread.Sleep(3000);

                var s1 = currentHaoZi.zfbPwd;

                LogManager.WriteLog(s1);
                MouseKeyBordHelper.KeyBoardDo(s1.ToCharArray());


                //var ss1 = "abcdtxyzABCDEFGXYZ0123456789";
                //LogManager.WriteLog(ss1);
                //MouseKeyBordHelper.KeyBoardDo(ss1.ToCharArray());



                //点击登录
                Thread.Sleep(3000);
                MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay + 80);

                MouseKeyBordHelper.GetCursorPos(out p1);
                LogManager.WriteLog("click point {0},{1} ".With(p1.X, p1.Y));



                //  CefFrameHelper.ExcuteJs(MainCefFrame, "document.getElementById('J-login-btn').click();");
                CefFrameHelper.ExcuteJs(MainCefFrame, "document.getElementById('J-login-btn').click();");
            }).Start();
        }
Esempio n. 7
0
        private void BT_TB_FILLZFB_Click(object sender, EventArgs e)
        {
            //new Thread(() => {
            //    Thread.Sleep(2000);
            string js2run = "document.getElementById('payPwd').value='{0}';".With(currentHaoZi.zfbPayPwd) +
                            "document.getElementById('payPwdConfirm').value='{0}';".With(currentHaoZi.zfbPayPwd) +
                            "document.getElementById('realName').value='{0}';".With(currentHaoZi.realname) +
                            "document.getElementById('IDCardNo').value='{0}';".With(currentHaoZi.zfbSFZ) +
                            "document.getElementById('J-complete-form').submit();";

            CefFrameHelper.ExcuteJs(MainCefFrame, js2run);


            //}).Start();
        }
Esempio n. 8
0
        //4   设置支付宝密保-填安保问题
        private void BT_zfb_reg_add_SecurityQuestion_Click(object sender, EventArgs e)
        {
            string js2run = "" +
                            "document.getElementById('J-question11').selectedIndex = {0};  ".With(currentHaoZi.mb_1_1) +
                            "document.getElementById('J-question12').selectedIndex = {0};     ".With(currentHaoZi.mb_1_2) +
                            "document.getElementById('J-question21').selectedIndex = {0};     ".With(currentHaoZi.mb_2_1) +
                            "document.getElementById('J-question22').selectedIndex = {0};     ".With(currentHaoZi.mb_2_2) +
                            "document.getElementById('J-question31').selectedIndex = {0};     ".With(currentHaoZi.mb_3_1) +
                            "document.getElementById('J-question32').selectedIndex = {0};     ".With(currentHaoZi.mb_3_2) +
                            "document.getElementById('J-answer1').value = '{0}';           ".With(currentHaoZi.mb_1_3) +
                            "document.getElementById('J-answer2').value = '{0}';           ".With(currentHaoZi.mb_2_3) +
                            "document.getElementById('J-answer3').value = '{0}';           ".With(currentHaoZi.mb_3_3) +
                            "document.getElementsByClassName('ui-button-text')[0].click(); ";

            CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
        }
Esempio n. 9
0
        //手机验证码
        //  public EventHandler GetMobilePhoneHandler;
        //
        private void BT_ZFB_REG_TB_new_alipay_q_Click(object sender, EventArgs e)
        {
            //1.输入信息
            LogManager.WriteLog(DateTime.Now.ToString() + "   " + currentHaoZi.zfbPayPwd + "    " + currentHaoZi.tbName);
            MainForm.state = BusinessStatus.nav2deliver_address;

            //string js1 = "document.getElementById('J_Nick').value = '{0}';".With(currentHaoZi.tbName) +
            //               "document.getElementsByClassName('btn-long')[0].click();";
            //CefFrameHelper.ExcuteJs(MainCefFrame, js1);


            //"document.getElementById('payPassword_rsainput').value = '{0}';".With(currentHaoZi.zfbPayPwd) +

            //输入手机号码
            int chax = ConfigHelper.GetIntValue("开通淘宝页面左边距");  // 600 - 61;
            int chay = ConfigHelper.GetIntValue("开通淘宝页面上边距");  // 562 - 171;


            MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay);

            LogManager.WriteLog(currentHaoZi.zfbPayPwd);
            MouseKeyBordHelper.KeyBoardDo(currentHaoZi.zfbPayPwd.ToCharArray());

            MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay + ConfigHelper.GetIntValue("开通淘宝页面待移动距离"));
            new Thread(() => {
                Thread.Sleep(2000);
                //2.手机验证
                string js2run = // "document.getElementById('payPassword_rsainput').value = '{0}';".With(currentHaoZi.zfbPayPwd) +
                                // " document.getElementsByClassName('btn-s')[1].click();" +
                                "document.getElementById('J_Nick').value = '{0}';".With(currentHaoZi.tbName) +
                                "document.getElementsByClassName('btn-long')[0].click();";
                CefFrameHelper.ExcuteJs(MainCefFrame, js2run);

                new Thread(() => {
                    Thread.Sleep(3000);

                    try {
                        GetPhone(sender, e);
                    } catch (Exception e2) {
                        LogManager.WriteLog(e2.StackTrace + e2.ToString());
                    }
                }).Start();
            }).Start();
        }
Esempio n. 10
0
        private bool UseThisPhoneNum(string phone)
        {
            string Vcode = "";
            bool   getPhoneOK;

            getPhoneOK = SmsConfigHelper.GetSmsOfPhone(phone, ref Vcode, "2");
            //////////////////
            if (getPhoneOK)
            {
                string num = Vcode;
                TB_TB_VCODE.Text = num;
                string js2run =
                    "document.getElementById('J_PhoneCheckCode').value='{0}';".With(num) +
                    "document.getElementsByClassName('btn-s tsl')[0].click();";
                CefFrameHelper.ExcuteJs(_mfForm.MainCefFrame, js2run);//提交验证码
            }
            //////////////////
            return(getPhoneOK);
        }
Esempio n. 11
0
        //
        private void toolStripMenuItem16_Click(object sender, EventArgs e)
        {
            Thread.Sleep(2000);
            CefFrameHelper.ExcuteJs(MainCefFrame, "document.getElementById('J-certNo').value='{0}';".With(currentHaoZi.zfbSFZ));

            new Thread(() => {
                #region ---输入支付密码---
                Thread.Sleep(1000);
                MouseKeyBordHelper.POINT p1;
                MouseKeyBordHelper.GetCursorPos(out p1);
                LogManager.WriteLog("鼠标位置 {0},{1}   ".With(p1.X, p1.Y));

                LogManager.WriteLog("程序界面位置 {0},{1}   ".With(this.Left, this.Top));

                LogManager.WriteLog("边距 {0},{1}   ".With(p1.X - this.Left, p1.Y - this.Top));

                int chax = 123;
                int chay = 232;
                Thread.Sleep(1000);
                MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay);

                Thread.Sleep(1000);
                var s1 = currentHaoZi.zfbPayPwd;
                LogManager.WriteLog(s1);
                MouseKeyBordHelper.KeyBoardDo(s1.ToCharArray());
                #endregion

                new Thread(() => {
                    Thread.Sleep(2000);
                    CefFrameHelper.ExcuteJs(MainCefFrame,
                                            "document.getElementById('J-selectStrategyForm').submit();");
                    //LogManager.WriteLog("mouse {0},{1}   ".With(p1.X, p1.Y));
                    //MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay + 65);
                }).Start();
            }).Start();
        }
Esempio n. 12
0
        private void Init_tb_reg()
        {
            if (IsInit_tb_loaded)
            {
                return;
            }
            IsInit_tb_loaded = true;

            //填会员信息
            Operation new_register = new Operation(MainCefFrame)
            {
                CurrentUrl     = "http://reg.taobao.com/member/new_register.jhtml",
                index          = 1,
                PerviousStatus = BusinessStatus.new_register,
                NextStatus     = BusinessStatus.new_cellphone_reg_two,
            };

            new_register.OperationHandler += (s, e) => {
                #region ==========填会员信息==========

                //获取ID=J_CheckCode 的data-imgurl属性的值url
                //识别url中的图片
                new Thread(() => {
                    string srcs = "";
                    for (int i = 0; i < 3; i++)
                    {
                        srcs = CefFrameHelper.GetUrlListByHapId(MainCefFrame, "J_CheckCode", "div", "data-imgurl").FirstOrDefault();
                        if (!string.IsNullOrEmpty(srcs))
                        {
                            break;
                        }
                    }
                    if (string.IsNullOrEmpty(srcs))
                    {
                        LogManager.WriteLog("重复3次后仍然无法获取图片。");
                        return;
                    }

                    srcs = srcs.Replace("&amp;", "&");
                    string returnMess;
                    var isVCodeOk = Vcode.GetVcodeFormImageUrl(srcs, out returnMess);


                    Console.WriteLine(isVCodeOk);
                    //
                    string js2run = "document.getElementById('J_Nick').value='{0}';".With(currentHaoZi.tbName) +
                                    "document.getElementById('J_Pwd').value='{0}';".With(currentHaoZi.tbPwd) +
                                    "document.getElementById('J_RePwd').value='{0}';".With(currentHaoZi.tbPwd) +
                                    "document.getElementById('J_Code').value='{0}';".With(returnMess) +
                                    "document.getElementById('J_BtnBasicInfoForm').click();";

                    CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
                }).Start();
                #endregion
            };

            //验证账户信息-选择方式(手机或邮箱)
            Operation new_cellphone_reg_two = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.new_cellphone_reg_two,
                NextStatus     = BusinessStatus.new_email_reg_two,
                CurrentUrl     = "http://reg.taobao.com/member/new_cellphone_reg_two.jhtml",
                index          = 2
            };
            new_cellphone_reg_two.OperationHandler += (s, e) => {
                //  BeginInvoke(new Action(() => {
                FindTitleAndLoadHref("使用邮箱验证");
                //   }));
            };

            //验证账户信息-选择方式(手机或邮箱)-输入邮箱手机打码
            Operation new_email_reg_three = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.new_email_reg_two,
                NextStatus     = BusinessStatus.new_email_reg_three,
                CurrentUrl     = "http://reg.taobao.com/member/new_email_reg_two.jhtml",
                index          = 3
            };
            new_email_reg_three.OperationHandler += (s, e) => {
                string js2runS1 = "document.getElementById('J_Email').value='{0}';".With(currentHaoZi.zfbEmail) +
                                  "document.getElementsByClassName('btn-b tsl')[0].click();";
                CefFrameHelper.ExcuteJs(MainCefFrame, js2runS1);
                this.bfForms.BT_TB_ChangeTel_Click(s, e);
            };

            //验证账户信息-选择方式(手机或邮箱)-获取激活链接
            Operation register_confirm = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.new_email_reg_three,
                NextStatus     = BusinessStatus.regitster_confirm,
                CurrentUrl     = "http://reg.taobao.com/member/new_email_reg_three.jhtml",
                index          = 4
            };
            register_confirm.OperationHandler += BT_FindActiveUrl_Click;

            //验证用户信息-完成
            Operation account_management = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.regitster_confirm,
                NextStatus     = BusinessStatus.account_management,
                CurrentUrl     = "http://reg.taobao.com/member/register_confirm.jhtml",
                //https://lab.alipay.com/user/reg/complete/completeTaobao.htm
                index = 5
            };
            account_management.OperationHandler += (s, e) => {
                MainCefFrame.LoadUrl("http://member1.taobao.com/member/fresh/account_management.htm");
            };

            Operation completeTaobao = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.account_management,
                NextStatus     = BusinessStatus.paymethod,
                CurrentUrl     = "http://member1.taobao.com/member/fresh/account_management.htm",
                index          = 6
            };
            completeTaobao.OperationHandler += (s, e) => {
                FindTitleAndLoadHref("立即补全");
            };

            Operation paymethod = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.paymethod,
                NextStatus     = BusinessStatus.zfb_Reg_paymethod,
                index          = 7,
                CurrentUrl     = "https://memberprod.alipay.com/account/reg/complete/complete.htm?scene=havanaComplete"
            };
            paymethod.OperationHandler += BT_TB_FILLZFB_Click;

            //===================支付宝注册流程

            Operation Zfb_Fill_Account = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.zfb_reg_begin,
                NextStatus     = BusinessStatus.emailCheck,
                CurrentUrl     = GlobalVar.zfb_Reg_enter_1,
                index          = 1, Deadline = 1000 * 60 * 5
            };
            Zfb_Fill_Account.OperationHandler += BT_Zfb_Fill_Account_Click;


            Operation emailCheck = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.emailCheck,
                NextStatus     = BusinessStatus.zfb_reg_link_complete,
                CurrentUrl     = "https://memberprod.alipay.com/account/reg/emailCheck.htm",
                index          = 1.1
            };
            emailCheck.OperationHandler += (s, e) => {
                BT_Zfb_Reg_Sumbit_s1_Click(this, new EventArgs());
            };

            Operation zfb_reg_link_complete = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.zfb_reg_link_complete,
                NextStatus     = BusinessStatus.zfb_Reg_paymethod,
                CurrentUrl     = GlobalVar.zfb_Reg_linkcomplete,
                index          = 2
            };
            zfb_reg_link_complete.OperationHandler += BT_Zfb_reg_fill_Click;

            Operation zfb_Reg_paymethod = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.zfb_Reg_paymethod,
                NextStatus     = BusinessStatus.zfb_reg_account_reg_success,
                CurrentUrl     = GlobalVar.zfb_Reg_paymethod,
                index          = 3
            };
            zfb_Reg_paymethod.OperationHandler += BT_ZFB_TB_Reg_Click;


            Operation zfb_reg_account_reg_success = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.zfb_reg_account_reg_success,
                NextStatus     = BusinessStatus.zfb_reg_account_reg_success,
                CurrentUrl     = GlobalVar.zfb_reg_account_reg_success,
                index          = 4,
                note           = "  导航至添加密保,跳到 开通淘宝"
            };
            //zfb_reg_account_reg_success.OperationHandler += BT_ZFB_REG_nav2addsq_Click;
            // BT_ZFB_REG_Account_Sucess_Click
            zfb_reg_account_reg_success.OperationHandler += BT_ZFB_REG_Account_Sucess_Click;

            Operation zfb_reg_skip_bindassetcard = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.zfb_reg_account_reg_success,
                //NextStatus = BusinessStatus.zfb_reg_taobao_open,//换
                NextStatus = BusinessStatus.zfb_reg_nav2set_add_SecurityQuestion_before,
                CurrentUrl = GlobalVar.zfb_reg_skip_bindassetcard,
                index      = 5
            };
            zfb_reg_skip_bindassetcard.OperationHandler += BT_ZFB_REG_TB_open_Click;

            Operation zfb_reg_taobao_new_alipay_q = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.zfb_reg_taobao_new_alipay_q,
                NextStatus     = BusinessStatus.nav2deliver_address,
                CurrentUrl     = GlobalVar.zfb_reg_taobao_new_alipay_q,
                index          = 31,
                note           = "开通tb",
                Deadline       = int.Parse(ConfigHelper.GetValue("zfb_reg_taobao_new_alipay_RegDeadline")) * 60 * 1000
            };

            zfb_reg_taobao_new_alipay_q.OperationHandler += BT_ZFB_REG_TB_new_alipay_q_Click;

            Operation nav2deliver_address = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.nav2deliver_address,
                NextStatus     = BusinessStatus.deliver_address,
                CurrentUrl     = "http://reg.taobao.com/member/register_confirm.jhtml",
                index          = 32,
                note           = "注册完成-跳转->添加收货地址的页面"
            };
            nav2deliver_address.OperationHandler += (s, e) => {
                MainCefFrame.LoadUrl(
                    "http://member1.taobao.com/member/fresh/deliver_address.htm");
            };


            Operation add_deliver_address = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.deliver_address,
                NextStatus     = BusinessStatus.ready,
                CurrentUrl     = "http://member1.taobao.com/member/fresh/deliver_address.htm",
                index          = 33,
                note           = "添加收货地址",
            };
            add_deliver_address.Deadline          = GlobalVar.DeadLineOfChangeClearAndPrepareNext;
            add_deliver_address.OperationHandler += (s, e) => {
                var js2run = RandomAddressPlace();
                CefFrameHelper.ExcuteJs(MainCefFrame, js2run);

                new Thread(() => {
                    currentHaoZi.regStatus = DateTime.Now.ToString();
                    currentHaoZi.tbStatus  = GlobalVar.CurrentIp;
                    HaoziHelper.UpdateLoadHaozi(ConfigHelper.GetValue("WebSite"), currentHaoZi, "add");
                    //        Thread.Sleep(6000);
                    LogManager.WriteLog("开始下一个");

                    ClearAndPrepareNext();
                }).Start();
            };

            this.opsList.Add(Zfb_Fill_Account);
            this.opsList.Add(emailCheck);
            this.opsList.Add(zfb_reg_link_complete);
            this.opsList.Add(zfb_Reg_paymethod);
            this.opsList.Add(zfb_reg_account_reg_success);
            this.opsList.Add(zfb_reg_skip_bindassetcard);
            this.opsList.Add(zfb_reg_taobao_new_alipay_q);

            this.opsList.Add(nav2deliver_address);
            this.opsList.Add(add_deliver_address);


            this.opsList.Add(new_register);
            this.opsList.Add(new_cellphone_reg_two);
            this.opsList.Add(new_email_reg_three);
            this.opsList.Add(register_confirm);
            this.opsList.Add(account_management);
            this.opsList.Add(completeTaobao);
            this.opsList.Add(paymethod);
        }
Esempio n. 13
0
        //zfb 过验证
        private void mobilephoeOfzfb2()
        {
            //1.login
            GlobalVar.sms = IMySmsFactory.Build(ConfigHelper.GetValue("smsConfigzfb"));
            GlobalVar.sms.GetConfigOfSms();//SmsConfigHelper.GetConfigOfSms();
            //if (!SmsApi.logined) {
            //    LogManager.WriteLog("登录失败");
            //    return;
            //}
            //2.
            string phoneNum = "";

            Application.DoEvents();
            //  lock (changeTel1) {
            bool getPhoneOK = false;
            bool isVcodeOk  = false;

            int TryPhoneNum          = int.Parse(ConfigHelper.GetValue("TryPhoneNum"));
            int TryPhoneNumInterTime = int.Parse(ConfigHelper.GetValue("TryPhoneNumInterTime"));

            for (int i = 0; i < TryPhoneNum; i++)
            {
                Thread.Sleep(2000);
                //2.1
                if (MainForm.state != BusinessStatus.emailCheck)
                {
                    LogManager.WriteLog("当前不是获取手机号码 的页面了.");
                    break;
                }

                //2.2 获取手机

                //GetPhone(ref string phoneNum,string serverid) {

                //支付宝注册
                getPhoneOK = GetPhone(ref phoneNum, SmsServer.zfb_reg_vcode);
                if (!getPhoneOK)
                {
                    continue;
                }

                //2.3 填充手机
                string js2run = "var mydoc=window.frames[2].document;";
                js2run +=
                    "mydoc.getElementById('J-secure-mobile').value = '{0}';".With(phoneNum) +
                    "mydoc.getElementById('J-getCheckcodeBtn').click();";
                CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
                LogManager.WriteLog("{0} is fill ".With(phoneNum));
                #region MyRegion

                // 2.4 检测手机是否可用
                LogManager.WriteLog("check valueOfStyle");
                string valueOfStyle       = "";
                bool   is_valueOfStyle_ok = false;
                for (int j = 0; j < 3; j++)
                {
                    // valueOfStyle = CefFrameHelper.GetUrlListByHapId(MainCefFrame, "J-resend-check-code", "div", "class").FirstOrDefault();
                    valueOfStyle = CefFrameHelper.GetMsgByJs(MainCefFrame, "mydoc.getElementById('J-resend-check-code').getAttribute('class')");
                    //.GetUrlListByHapId(MainCefFrame, "J-resend-check-code", "div", "class").FirstOrDefault();

                    //
                    LogManager.WriteLog("valueOfStyle:" + valueOfStyle);
                    is_valueOfStyle_ok = (valueOfStyle != null && !valueOfStyle.Contains("fn-hide"));
                    if (is_valueOfStyle_ok)
                    {
                        break;
                    }

                    Application.DoEvents();
                    Thread.Sleep(2000);
                }
                if (!is_valueOfStyle_ok)
                {
                    LogManager.WriteLog("手机号码 {1} 不可用.重新获取,{0}".With(7 - i, phoneNum));
                    //释放单个手机
                    //   SmsApi.ReleasePhone(phoneNum, "1365");
                    continue;
                }

                #endregion

                //2.5 手机可用则接收短信

                LogManager.WriteLog("检查通过,手机号码 {0} 可用.".With(phoneNum));
                string vcodeNum = "";
                //  isVcodeOk = SmsConfigHelper.GetSmsOfPhone(phoneNum, ref vcodeNum,SmsServer.zfb_reg_vcode);
                //    isVcodeOk = SmsConfigHelper.GetSmsOfPhone(phoneNum, ref vcodeNum, SmsServer.zfb_reg_vcode);
                isVcodeOk = SmsConfigHelper.GetSmsOfPhone(phoneNum, ref vcodeNum, SmsServer.zfb_reg_vcode);

                if (!isVcodeOk)
                {
                    LogManager.WriteLog("没有收到验证码,返回重新接收");

                    //页面上点击 返回修改手机号码
                    //string jsOfChangePhoneNum = "document.getElementById('J_RewritePhone').click()';";
                    //CefFrameHelper.ExcuteJs(MainCefFrame, jsOfChangePhoneNum);
                    continue;
                }
                //2.6 接收到短信则提交
                //                document.getElementById('J_PhoneCheckCode').value='295768';
                //document.getElementsByClassName('btn-s')[0].click();

                string jsOfSubmitVcode = "var mydoc=window.frames[2].document;";
                jsOfSubmitVcode += "mydoc.getElementById('J-checkcode').value='{0}';".With(vcodeNum) +
                                   "mydoc.getElementById('J-submit-btn').click();";
                CefFrameHelper.ExcuteJs(MainCefFrame, jsOfSubmitVcode);//提交验证码
                LogManager.WriteLog("tel {0} ".With(phoneNum));
                GlobalVar.phoneNum = phoneNum;

                break;
            }
            //     }).Start();
            //   };
        }
Esempio n. 14
0
        //手机验证
        private void phoneVailed(BusinessStatus nowStatus)
        {
            //}

            //public void GetPhone2(object sender, EventArgs e) {
            //1.login


            string phoneNum = "";

            Application.DoEvents();
            //  lock (changeTel1) {
            bool getPhoneOK = false;
            bool isVcodeOk  = false;



            int TryPhoneNumTB = int.Parse(ConfigHelper.GetValue("TryPhoneNumTB"));

            if (ConfigHelper.GetValue("smsConfigtb") == "aima" || ConfigHelper.GetValue("smsConfigtb") == "jike")
            {
                GlobalVar.sms = IMySmsFactory.Build(ConfigHelper.GetValue("smsConfigtb"));
                GlobalVar.sms.GetConfigOfSms();//SmsConfigHelper.GetConfigOfSms();
            }

            for (int i = 0; i < TryPhoneNumTB; i++)
            {
                if (ConfigHelper.GetValue("smsConfigtb") == "both")
                {
                    GlobalVar.sms = IMySmsFactory.Build(i % 2 == 1 ? "jike" : "aima");
                    GlobalVar.sms.GetConfigOfSms();//SmsConfigHelper.GetConfigOfSms();
                }

                Thread.Sleep(1000);
                //2.1 检测是否当前已经通过手机验证

                if (MainForm.state != nowStatus)
                {
                    LogManager.WriteLog("当前不是获取手机号码 的页面了.");
                    break;
                }
                //2.2 获取手机
                getPhoneOK = SmsConfigHelper.GetPhone(ref phoneNum);
                if (!getPhoneOK)
                {
                    continue;
                }
                //getPhoneOK = true;
                //phoneNum = GlobalVar.phoneNum;
                //2.3 填充手机
                string js2run =
                    "document.getElementById('J_Mobile').value = '{0}';".With(phoneNum) +
                    "document.getElementById('J_BtnMobileCode').click();";

                LogManager.WriteLog(js2run);

                CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
                LogManager.WriteLog("{0} is fill 填充手机 ".With(phoneNum));

                Application.DoEvents();

                //2.4 检测手机是否可用
                LogManager.WriteLog("检测手机是否可用");
                string valueOfStyle       = "";
                bool   is_valueOfStyle_ok = false;
                for (int j = 0; j < 2; j++)
                {
                    Thread.Sleep(3000);
                    valueOfStyle = CefFrameHelper.GetMsgByJs3(MainCefFrame, "document.getElementById('J_MsgMobileCode').getAttribute('class')");

                    LogManager.WriteLog("valueOfStyle:" + valueOfStyle);
                    is_valueOfStyle_ok = (valueOfStyle != null && valueOfStyle.Contains("ok"));
                    if (is_valueOfStyle_ok)
                    {
                        break;
                    }
                    Application.DoEvents();
                }
                if (!is_valueOfStyle_ok)
                {
                    LogManager.WriteLog("手机号码 {1} 不可用 释放并拉黑.重新获取,{0}".With(TryPhoneNumTB - i, phoneNum));
                    //释放单个手机
                    GlobalVar.sms.ReleasePhone(phoneNum, SmsServer.tb_reg_vode); // SmsApi.ReleasePhone(phoneNum, "2");
                    continue;
                }


                //2.5 手机可用则接收短信
                LogManager.WriteLog("手机号码 {0} 可用.".With(phoneNum));

                string vcodeNum = "";
                isVcodeOk = SmsConfigHelper.GetSmsOfPhoneTBREGV3_1(phoneNum, ref vcodeNum, SmsServer.tb_reg_vode);

                if (!isVcodeOk)
                {
                    LogManager.WriteLog("没有收到验证码,返回重新接收");
                    continue;
                }

                if (ConfigHelper.GetBoolValue("tbModelTest"))  //开启测试模式,记录手机号码并释放手机号码,跳转到支付宝注册
                {
                    GlobalVar.availabePhone = phoneNum;
                    GlobalVar.sms.ReleasePhone(phoneNum, SmsServer.tb_reg_login_vcode);
                    BT_Reg_zfb_Click(this, new EventArgs());
                }


                //2.6 接收到短信则提交
                //                document.getElementById('J_PhoneCheckCode').value='295768';
                //document.getElementsByClassName('btn-s')[0].click();

                string jsOfSubmitVcode =
                    "document.getElementById('J_MobileCode').value='{0}';".With(vcodeNum) +
                    "document.getElementById('J_BtnMobileCodeForm').click();" +
                    "document.getElementById('J_BtnMobileCodeForm').click();";
                //J_BtnMobileCodeForm
                //J_BtnMobileForm
                CefFrameHelper.ExcuteJs(MainCefFrame, jsOfSubmitVcode);//提交验证码
                if (GlobalVar.debug)
                {
                    LogManager.WriteLog(vcodeNum);
                    LogManager.WriteLog(jsOfSubmitVcode);
                }
                GlobalVar.phoneNum = phoneNum;
                break;
            }
            //     }).Start();
            //   };
        }
Esempio n. 15
0
        private void tbV3_Init_reg()
        {
            if (IsInit_tbV3_loaded)
            {
                return;
            }
            IsInit_tbV3_loaded = true;

            Operation fill_mobile = new Operation(MainCefFrame)
            {
                CurrentUrl     = "http://reg.taobao.com/member/reg/fill_mobile.htm",
                index          = 1.1,
                PerviousStatus = BusinessStatus.Tb_reg_v3_member_reg_fill_mobile_before,
                NextStatus     = BusinessStatus.Tb_reg_v3_member_reg_fill_mobile,
            };

            fill_mobile.OperationHandler += (s, e) => {
                string js2run = "document.getElementsByClassName('f12')[1].getElementsByTagName('a')[0].click()";
                CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
            };


            //填会员信息
            Operation new_register = new Operation(MainCefFrame)
            {
                CurrentUrl     = "http://reg.taobao.com/member/reg/fill_email.htm",
                index          = 1.2,
                PerviousStatus = BusinessStatus.Tb_reg_v3_member_reg_fill_mobile,
                NextStatus     = BusinessStatus.Tb_reg_v3_member_reg_fill_email,
                Deadline       = ConfigHelper.GetIntValue("TBV3注册第一步耗时") * 1000 * 60,
            };

            new_register.OperationHandler += (s, e) => {
                #region ==========填会员信息&过手机验证==========

                //获取ID=J_CheckCode 的data-imgurl属性的值url
                //识别url中的图片

                string js3run = "document.getElementById('J_CheckCodeInput').focus();";

                CefFrameHelper.ExcuteJs(MainCefFrame, js3run);
                new Thread(() => {
                    Thread.Sleep(ConfigHelper.GetIntValue("等待验证码时间(秒)") * 1000);
                    var isVCodeOk = false;
                    for (int j = 0; !isVCodeOk && j < 3; j++)
                    {
                        bool vcodeFrom51 = false;
                        string srcs      = "";
                        for (int i = 0; i < 3; i++)
                        {
                            //srcs = CefFrameHelper.GetUrlListByHapId(MainCefFrame, "J_CheckCodeContainer", "div", "data-imgurl").FirstOrDefault();


                            srcs = CefFrameHelper.GetUrlListByHapId(MainCefFrame, "J_CheckCodeImg1", "img", "src").FirstOrDefault();
                            srcs = srcs.Replace("&amp;", "&");
                            if (!string.IsNullOrEmpty(srcs))
                            {
                                break;
                            }
                        }
                        if (string.IsNullOrEmpty(srcs))
                        {
                            LogManager.WriteLog("重复3次后仍然无法获取图片。");
                            return;
                        }

                        string returnMess;
                        vcodeFrom51 = Vcode.GetVcodeFormImageUrl(srcs, out returnMess);
                        if (!vcodeFrom51)
                        {
                            continue;
                        }

                        string js2run = "document.getElementById('J_Email').value='{0}';".With(currentHaoZi.zfbEmail) +
                                        "document.getElementById('J_CheckCodeInput').value='{0}';".With(returnMess) +
                                        "document.getElementById('J_BtnEmailForm').click();";

                        CefFrameHelper.ExcuteJs(MainCefFrame, js2run);

                        #region    ==================过验证码====================



                        new Thread(() => {
                            Thread.Sleep(3000);
                            var res = "";

                            for (int i = 0; i < 3; i++)
                            {
                                res = CefFrameHelper.GetMsgByJs(MainCefFrame, "document.getElementById('J_MobileCheck').getAttribute('style')");
                                if (!string.IsNullOrEmpty(res))
                                {
                                    break;
                                }
                                Thread.Sleep(1000);
                            }
                            if (res.Contains("block"))
                            {
                                isVCodeOk = true;
                            }
                            checkVcodeOkEvent.Set();
                        }).Start();
                        checkVcodeOkEvent.Reset();
                        checkVcodeOkEvent.WaitOne(9000);
                        #endregion

                        if (isVCodeOk)
                        {
                            break;
                        }
                    }

                    //手机验证

                    new Thread(() => {
                        try {
                            phoneVailed(state);
                        } catch (Exception e2) {
                            LogManager.WriteLog(e2.StackTrace + e2.ToString());
                        }
                    }).Start();
                    //
                }).Start();
                #endregion
            };

            //账户注册-1.设置登录名-接收邮件
            Operation email_sent = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.Tb_reg_v3_member_reg_fill_email,
                NextStatus     = BusinessStatus.Tb_reg_v3_member_reg_email_sent,
                CurrentUrl     = "http://reg.taobao.com/member/reg/email_sent.htm",
                index          = 2,
                note           = "账户注册-1.设置登录名-接收邮件"
            };
            email_sent.OperationHandler += (s, e) => {
                //  BeginInvoke(new Action(() => {
                Thread.Sleep(5000);
                var url = EmailCheck("新用户确认通知信", "request_dispatcher.htm");
                MainCefFrame.LoadUrl(url);
                //   }));
            };

            Operation fill_user_info = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.Tb_reg_v3_member_reg_email_sent,
                NextStatus     = BusinessStatus.Tb_reg_v3_Member_reg_fill_user_info,
                CurrentUrl     = "http://reg.taobao.com/member/reg/fill_user_info.htm",
                index          = 3,
                note           = "账户注册-2.填写账户信息"
            };
            fill_user_info.OperationHandler += (s, e) => {
                string js2runS1 =
                    "document.getElementById('J_Password').value='{0}';".With(currentHaoZi.tbPwd) +
                    "document.getElementById('J_RePassword').value='{0}';".With(currentHaoZi.tbPwd) +
                    "document.getElementById('J_Nick').value='{0}';".With(currentHaoZi.tbName) +
                    "document.getElementById('J_BtnInfoForm').click();";
                CefFrameHelper.ExcuteJs(MainCefFrame, js2runS1);
            };


            Operation login_unusual = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.Tb_reg_v3_Member_reg_fill_user_info,
                NextStatus     = BusinessStatus.Tb_reg_v3_member_reg_reg_success,
                CurrentUrl     = "http://login.taobao.com/member/login_unusual.htm",
                //http://login.taobao.com/member/login_unusual.htm
                index = 4.1,
                note  = "登录身份验证 ",
            };
            login_unusual.OperationHandler += (s, e) => {
                toolStripMenuItem20_Click(this, new EventArgs());//过登录验证
            };


            Operation member_reg_reg_success = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.Tb_reg_v3_Member_reg_fill_user_info,
                NextStatus     = BusinessStatus.Tb_reg_v3_member_reg_reg_success,
                CurrentUrl     = "http://reg.taobao.com/member/reg/reg_success.htm",
                index          = 4.2,
                note           = "淘宝注册成功 填写收货地址",
            };
            member_reg_reg_success.OperationHandler += (s, e) => {
                //var url = "http://member1.taobao.com/member/fresh/account_management.htm";

                var url = "http://member1.taobao.com/member/fresh/deliver_address.htm";
                MainCefFrame.LoadUrl(url);
            };


            Operation deliver_address = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.Tb_reg_v3_member_reg_reg_success,
                NextStatus     = BusinessStatus.Tb_reg_v3_deliver_address,
                CurrentUrl     = "http://member1.taobao.com/member/fresh/deliver_address.htm",
                index          = 33,
                note           = "添加收货地址 判断是否激活支付宝  ",
            };
            deliver_address.OperationHandler += (s, e) => {
                var js2run = RandomAddressPlace();
                CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
                new Thread(() => {
                    Application.DoEvents();
                    Thread.Sleep(3000);

                    bool activeZFB = ConfigHelper.GetBoolValue("是否激活支付宝");
                    if (activeZFB)
                    {
                        var url = "http://member1.taobao.com/member/fresh/account_management.htm";
                        MainCefFrame.LoadUrl(url);
                    }
                    else
                    {
                        FinishOneResgister();
                    }
                }).Start();
            };


            Operation member_fresh_account_management = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.Tb_reg_v3_deliver_address,
                NextStatus     = BusinessStatus.Tb_reg_v3_member_fresh_account_management,
                CurrentUrl     = "http://member1.taobao.com/member/fresh/account_management.htm",
                index          = 5,
                note           = "找到 包含 立即补全 的链接  前往"
            };

            member_fresh_account_management.OperationHandler += (s, e) => {
                string js2runS1 = "document.getElementsByClassName('kv_item')[2].getElementsByTagName('a')[0].click();";
                CefFrameHelper.ExcuteJs(MainCefFrame, js2runS1);
            };


            Operation account_reg_complete_complete = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.Tb_reg_v3_member_fresh_account_management,
                NextStatus     = BusinessStatus.Tb_reg_v3_account_reg_complete_complete,
                CurrentUrl     = "https://memberprod.alipay.com/account/reg/complete/complete.htm",
                index          = 6,
                note           = "开通支付宝 填支付密码"
            };
            account_reg_complete_complete.OperationHandler += (s, e) => {
                string js2runS1 =
                    "         document.getElementById('queryPwd').value='{0}';".With(currentHaoZi.zfbPwd) +
                    "document.getElementById('queryPwdConfirm').value='{0}';".With(currentHaoZi.zfbPwd) +
                    "document.getElementById('payPwd').value='{0}';".With(currentHaoZi.zfbPayPwd) +
                    "document.getElementById('payPwdConfirm').value='{0}';".With(currentHaoZi.zfbPayPwd) +
                    "document.getElementById('realName').value='{0}';".With(currentHaoZi.realname) +
                    "document.getElementById('IDCardNo').value='{0}';".With(currentHaoZi.zfbSFZ) +
                    "document.getElementById('J-complete-form').submit();";
                CefFrameHelper.ExcuteJs(MainCefFrame, js2runS1);
            };


            Operation asset_paymethod_paymethod = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.Tb_reg_v3_account_reg_complete_complete,
                NextStatus     = BusinessStatus.Tb_reg_v3_asset_paymethod_paymethod,
                CurrentUrl     = "https://zht.alipay.com/asset/paymethod/paymethod.htm",
                index          = 7
            };

            asset_paymethod_paymethod.OperationHandler += (s, e) => {
                MainCefFrame.LoadUrl("https://benefitprod.alipay.com/asset/paymethod/bindassetcard.htm");
            };


            Operation account_reg_success = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.Tb_reg_v3_asset_paymethod_paymethod,
                NextStatus     = BusinessStatus.Tb_reg_v3_account_reg_success,
                CurrentUrl     = "https://memberprod.alipay.com/account/reg/success.htm",
                index          = 8,
                note           = "开通支付宝成功"
            };

            account_reg_success.OperationHandler += (s, e) => {
                // new Thread(() => {

                FinishOneResgister();
                //  }).Start();
            };



            this.opsList.Add(fill_mobile);
            this.opsList.Add(new_register);
            this.opsList.Add(email_sent);
            this.opsList.Add(login_unusual);

            this.opsList.Add(fill_user_info);
            this.opsList.Add(member_reg_reg_success);
            this.opsList.Add(deliver_address);
            this.opsList.Add(member_fresh_account_management);
            this.opsList.Add(account_reg_complete_complete);
            this.opsList.Add(asset_paymethod_paymethod);
            this.opsList.Add(account_reg_success);
        }
Esempio n. 16
0
        public void BT_Zfb_Fill_Account_Click(object sender, EventArgs e)
        {
            //  state = BusinessStatus.zfb_reg_link_complete;

            Operation operation = sender as Operation;

            if (operation != null)
            {
                if (!MainCefFrame.Url.Contains(GlobalVar.zfb_Reg_enter_1))
                {
                    LogManager.WriteLog("已经不是当前页了");
                    return;
                }
            }
            for (int i = 0; i < 7; i++)
            {
                //利用hpk获取到url
                string srcs = "";
                for (int g = 0; g < 3; g++)
                {
                    srcs = CefFrameHelper.GetUrlListByHapId(MainCefFrame, "J-checkcode-img", "img", "src").FirstOrDefault();
                    if (!string.IsNullOrEmpty(srcs))
                    {
                        break;
                    }
                    Application.DoEvents();
                    Thread.Sleep(2000);
                }
                if (string.IsNullOrEmpty(srcs))
                {
                    LogManager.WriteLog("重复3次后仍然无法获取图片的链接。");
                    return;
                }


                //2获取验证码

                string vcode;
                bool   isVCodeOk = Vcode.GetVcodeFormImageUrl(srcs, out vcode);
                LogManager.WriteLog("{0}    {1} ".With(isVCodeOk, vcode));

                //3 提交验证码
                if (isVCodeOk)
                {
                    string js2run = " document.getElementById('J-accName').value = '{0}';".With(currentHaoZi.zfbEmail)
                                    + " document.getElementById('J-checkcode').value = '{0}';".With(vcode)
                                    + "document.getElementById('J-index-form').submit();"
                                    + "document.getElementsByClassName('ui-button-text')[0].click();";
                    CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
                }
                else
                {
                    LogManager.WriteLog("请手动刷新并输入验证码,再提交。");
                }

                //4 检查验证码是否正确
                //2  检测 是否可用
                //LogManager.WriteLog("check checkcodeIcon");
                //string valueOfStyle = "";
                //bool is_valueOfStyle_ok = false;
                //for (int j = 0; j < 3; j++) {
                //    valueOfStyle =
                //        CefFrameHelper.GetUrlListByHapId(MainCefFrame, "checkcodeIcon", "span", "class")
                //            .FirstOrDefault();
                //    LogManager.WriteLog("checkcodeIcon:" + valueOfStyle);
                //    is_valueOfStyle_ok = !(valueOfStyle == null || valueOfStyle.Contains("checkcodeIcon-wrong"));
                //    if (is_valueOfStyle_ok) {
                //        break;
                //    }
                //    Application.DoEvents();
                //    Thread.Sleep(2000);

                //}

                //if (!is_valueOfStyle_ok) {
                //    continue;
                //}

                //手机过验证码
                mobilephoeOfzfb();


                //收取邮件
                //BT_Zfb_Reg_Sumbit_s1_Click(vcode, new EventArgs());
                break;
            }
        }
Esempio n. 17
0
        //淘宝V2 更换手机号码
        //1.登录手机
        //2.获取可用手机()
        //  2.1 获取手机
        //3.获取可用短信
        public void BT_TB_ChangeTel_Click(object sender, EventArgs e)
        {
            //1.登录手机
            SmsConfigHelper.GetConfigOfSms();

            if (!SmsApi.logined)
            {
                LBS_sms.Text = "登录失败";
                return;
            }
            string phone = "";


            Application.DoEvents();
            lock (changeTel) {
                bool getPhoneOK = false;
                bool isVcodeOk  = false;
                new Thread(() => {
                    Thread.Sleep(2000);
                    // bool isTelOK = false;
                    for (int i = 0; i < 7; i++)
                    {
                        //2.1 检测是否当前已经通过手机验证
                        if (MainForm.state == BusinessStatus.regitster_confirm)
                        {
                            LogManager.WriteLog("当前不是获取手机号码{0}的页面了.".With(phone));
                            MainForm.state = BusinessStatus.new_email_reg_two;
                            _mfForm.MainCefFrame.Browser.GoBack();

                            getPhoneOK = true;
                            break;
                        }

                        //2.2 获取手机
                        phone = EnterPhone();

                        //2.3 检测手机是否可用
                        LogManager.WriteLog("check valueOfStyle");
                        string valueOfStyle     = "";
                        bool is_valueOfStyle_ok = false;
                        for (int j = 0; j < 3; j++)
                        {
                            valueOfStyle = CefFrameHelper.GetUrlListByHapId(MainCefFrame, "J_PhoneFormTip", "div", "style").FirstOrDefault();
                            LogManager.WriteLog("valueOfStyle:" + valueOfStyle);
                            is_valueOfStyle_ok = valueOfStyle != null && valueOfStyle.Contains("hidden");
                            if (is_valueOfStyle_ok)
                            {
                                break;
                            }
                            else
                            {
                                Application.DoEvents();
                                Thread.Sleep(2000);
                            }
                        }


                        if (valueOfStyle != null && valueOfStyle.Contains("hidden"))
                        {
                            //可用
                            LogManager.WriteLog("手机号码 {0} 可用.".With(phone));
                            isVcodeOk = UseThisPhoneNum(phone);
                            if (isVcodeOk)
                            {
                                break;
                            }
                            else
                            {
                                //未获取到验证码的处理
                                TB_SMS_MSG.Text = "没有收到验证码,返回重新接收";
                                LogManager.WriteLog(TB_SMS_MSG.Text);
                                //   new Thread(() => {
                                //页面上点击 返回修改手机号码
                                string js2run = "document.getElementById('J_RewritePhone').click()';";
                                CefFrameHelper.ExcuteJs(_mfForm.MainCefFrame, js2run);
                            }
                        }
                        else
                        {
                            LogManager.WriteLog("手机号码 {1} 不可用.重新获取,{0}".With(5 - i, phone));
                            //释放单个手机
                            SmsApi.ReleasePhone(phone, "2");
                        }
                    }
                    if (!getPhoneOK || !isVcodeOk)
                    {
                        _mfForm.ShowStatus("获取手机失败,重新获取,或者自己去网站获取。");
                    }
                }).Start();
            }

            //    BT_ZFB_REG_TB_SMS_ENTERVCODE_Click(sender, e);
        }
Esempio n. 18
0
        //5   设置支付宝密保-确认
        private void BT_zfb_reg_add_SecurityQuestion_setQa_confirm_Click(object sender, EventArgs e)
        {
            string js2run = "document.getElementsByClassName('ui-button-text')[0].click();";

            CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
        }
Esempio n. 19
0
        public void GetPhone(object sender, EventArgs e)
        {
            //1.login


            //if (!SmsApi.logined) {
            //    LogManager.WriteLog("登录失败");
            //    return;
            //}
            //2.
            string phoneNum = "";

            Application.DoEvents();
            //  lock (changeTel1) {
            bool getPhoneOK = false;
            bool isVcodeOk  = false;
            //   new Thread(() => {
            //   Thread.Sleep(2000);


            int TryPhoneNumTB = int.Parse(ConfigHelper.GetValue("TryPhoneNumTB"));

            if (ConfigHelper.GetValue("smsConfigtb") == "aima" || ConfigHelper.GetValue("smsConfigtb") == "jike")
            {
                GlobalVar.sms = IMySmsFactory.Build(ConfigHelper.GetValue("smsConfigtb"));
            }

            for (int i = 0; i < TryPhoneNumTB; i++)
            {
                if (ConfigHelper.GetValue("smsConfigtb") == "both")
                {
                    GlobalVar.sms = IMySmsFactory.Build(i % 2 == 1 ? "jike" : "aima");
                }



                GlobalVar.sms.GetConfigOfSms();//SmsConfigHelper.GetConfigOfSms();
                Thread.Sleep(1000);
                //2.1 检测是否当前已经通过手机验证

                if (MainForm.state != BusinessStatus.nav2deliver_address)
                {
                    LogManager.WriteLog("当前不是获取手机号码 的页面了.");

                    break;
                }
                //2.2 获取手机

                getPhoneOK = GetPhone(ref phoneNum);//开通淘宝
                if (!getPhoneOK)
                {
                    continue;
                }
                //getPhoneOK = true;
                //phoneNum = GlobalVar.phoneNum;
                //2.3 填充手机
                string js2run =
                    "document.getElementById('J_PhoneInput').value = '{0}';".With(phoneNum) +
                    "document.getElementsByClassName('btn-b')[0].click();";
                CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
                LogManager.WriteLog("{0} is fill 填充手机 ".With(phoneNum));

                //2.4 检测手机是否可用
                LogManager.WriteLog("检测手机是否可用");
                string valueOfStyle       = "";
                bool   is_valueOfStyle_ok = false;
                for (int j = 0; j < 2; j++)
                {
                    Thread.Sleep(3000);
                    valueOfStyle = CefFrameHelper.GetMsgByJs3(MainCefFrame, "document.getElementById('J_PhoneFormTip').getAttribute('style')");

                    //    valueOfStyle = CefFrameHelper.GetUrlListByHapId(MainCefFrame, "J_PhoneFormTip", "div", "style").FirstOrDefault();
                    LogManager.WriteLog("valueOfStyle:" + valueOfStyle);
                    is_valueOfStyle_ok = (valueOfStyle != null && valueOfStyle.Contains("hidden"));
                    if (is_valueOfStyle_ok)
                    {
                        break;
                    }

                    Application.DoEvents();
                }
                if (!is_valueOfStyle_ok)
                {
                    LogManager.WriteLog("手机号码 {1} 不可用 释放并拉黑.重新获取,{0}".With(TryPhoneNumTB - i, phoneNum));
                    //释放单个手机
                    GlobalVar.sms.ReleasePhone(phoneNum, SmsServer.tb_reg_vode); // SmsApi.ReleasePhone(phoneNum, "2");
                    continue;
                }


                //2.5 手机可用则接收短信
                LogManager.WriteLog("手机号码 {0} 可用.".With(phoneNum));
                string vcodeNum = "";
                isVcodeOk = SmsConfigHelper.GetSmsOfPhone(phoneNum, ref vcodeNum, SmsServer.tb_reg_vode);

                if (!isVcodeOk)
                {
                    LogManager.WriteLog("没有收到验证码,返回重新接收");

                    //页面上点击 返回修改手机号码
                    string jsOfChangePhoneNum = "document.getElementById('J_RewritePhone').click()';";
                    CefFrameHelper.ExcuteJs(MainCefFrame, jsOfChangePhoneNum);
                    continue;
                }
                //2.6 接收到短信则提交
                //                document.getElementById('J_PhoneCheckCode').value='295768';
                //document.getElementsByClassName('btn-s')[0].click();

                string jsOfSubmitVcode =
                    "document.getElementById('J_PhoneCheckCode').value='{0}';".With(vcodeNum) +
                    "document.getElementsByClassName('btn-s')[0].click();";
                CefFrameHelper.ExcuteJs(MainCefFrame, jsOfSubmitVcode);//提交验证码


                break;
            }
            //     }).Start();
            //   };
        }
Esempio n. 20
0
        private void ChooseOneItem(object sender, LoadEndEventArgs eventHandler)
        {
            //ReflushIfInFrames();

            bool   isok     = false;
            string maxprice = ConfigHelper.GetValue("maxPrice");
            string minNum   = ConfigHelper.GetValue("待购宝贝最少销量");
            var    arrayStr = ArrayStr();


            LogManager.WriteLog(arrayStr);

            for (int i = 0; i < 3; i++)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(beforejs);
                //  js2run += "  var a1=mydoc.getElementsByClassName('page-container J_PageContainer_1')[0]; var lis=a1.getElementsByTagName('li');var index=Math.round(Math.random()*lis.length); window.location=lis[index].getElementsByTagName('a')[0].href;";
                sb.Append("var  shopping =new Array ( {0} );".With(arrayStr));
                sb.Append(
                    "if(window.frames.length!=0){mydoc=window.frames[0].document;}else{mydoc=document;}var a1=mydoc.getElementsByClassName('page-container J_PageContainer_1')[0];var lis=a1.getElementsByTagName('li'); ");
                sb.Append("while(1){var index=Math.floor(Math.random()*lis.length); var li0=lis[index];var li0_h=li0.getElementsByClassName('h')[0]; var li0_h_int=li0_h.innerText.substring(1,li0_h.innerHTML.length);var li0_num=li0.getElementsByClassName('d-num')[0]; var li0_num_int=li0_num.innerText.substring(0,li0_num.innerHTML.length-3); ");
                sb.Append("if(li0_h_int< " + maxprice + " &&  li0_num_int>" + minNum + " ){ ");
                sb.Append("var desturl=li0.getElementsByTagName('a')[0].href;desturl=desturl.substring(0,desturl.indexOf('&'));var exist=false;for(var t1=0;t1<t1.length;t1++){if(shopping[t1]==desturl){exist=true;break;}}if(!exist){window.location=desturl; break;} }}");


                var js2run = sb.ToString();
                CefFrameHelper.ExcuteJs(MainCefFrame, js2run);


                if (ConfigHelper.GetBoolValue("debug"))
                {
                    LogManager.WriteLog(js2run);
                }

                waitchooseResetEvent.Reset();
                new Thread(() => {
                    Thread.Sleep(2000);
                    var url = MainCefFrame.Url;
                    if (!url.Contains("http://h5.m.taobao.com/awp/mtb/mtb.htm"))
                    {
                        isok = true;
                        return;
                    }
                    else
                    {
                        shoppingUrls.Add(url.Substring(0, url.IndexOf('&')));
                    }
                    //  LogManager.WriteLog(js2run);

                    LogManager.WriteLog("未能进入下一页 {0}".With(i));

                    waitchooseResetEvent.Set();
                }).Start();

                waitchooseResetEvent.WaitOne();
                if (isok)
                {
                    LogManager.WriteLog("已经跳转到下一页  ");
                    break;
                }

                LogManager.WriteLog("等待5秒钟");
                Thread.Sleep(1000 * 5);
            }
        }
Esempio n. 21
0
        private void IsInit_wapshop()
        {
            if (IsInit_wapshop_loaded)
            {
                return;
            }

            Operation mtb = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.mtb,
                NextStatus     = BusinessStatus.gerenzhongxin,
                CurrentUrl     = "login.m.taobao.com/login.htm",
                index          = 1,
                note           = "登录"
            };

            mtb.OperationHandler += (s, e) => {
                //  if (GlobalVar.tbmode == tbModel.shopv2) {
                //window.onload=function(){if(window.frames.length!=0){window.location.reload();}}
                //ReflushIfInFrames();
                //  }
                taskRunner.LogAccontStatus("|{0}".With(MouseKeyBordHelper.CurrentIP));//
                #region ==========识别验证码==========
                //1.识别验证码
                string srcs = "";
                for (int i = 0; i < 3; i++)
                {
                    //   //Img Id=J_StandardCode  data-url
                    srcs = CefFrameHelper.GetUrlListByHapId(MainCefFrame, "J_StandardCode", "img", "data-url").FirstOrDefault();
                    if (!string.IsNullOrEmpty(srcs))
                    {
                        break;
                    }
                }
                if (string.IsNullOrEmpty(srcs))
                {
                    LogManager.WriteLog("重复3次后仍然无法获取图片。");
                    return;
                }
                string returnMess;
                var    isVCodeOk = Vcode.GetVcodeFormImageUrl(srcs, out returnMess);


                //2.提交验证码
                string js2run = beforejs + " mydoc.getElementById('J_UserNameTxt').value='{0}';".With(currentHaoZi.tbName) +
                                "mydoc.getElementById('J_PassWordTxt').value='{0}';".With(currentHaoZi.tbPwd) +
                                "mydoc.getElementById('J_AuthCodeTxt').value='{0}';".With(returnMess) +
                                "mydoc.getElementsByClassName('c-btn-oran-big')[0].click();";
                if (isVCodeOk)
                {
                    //   LogManager.WriteLog(js2run);

                    CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
                }
                else
                {
                    LogManager.WriteLog("验证码识别出错。等待2分钟后重新执行");
                }

                new Thread(() => {
                    Thread.Sleep(3000);
                    if (isCurrentPage(s as Operation))
                    {
                        LogManager.WriteLog("还在当前页");
                        string warnmsg = CefFrameHelper.ExtractWarnMsg(MainCefFrame).Trim();
                        if (warnmsg == "该账户名不存在")
                        {
                            taskRunner.ReportAccountStatus("buy", "failed", warnmsg);
                            ClearAndPrepareNext();
                        }
                        ;
                    }
                }).Start();


                #endregion
            };
            //
            Operation mtbloginEx = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.gerenzhongxin,
                NextStatus     = BusinessStatus.wapshop_ex_loginerror,
                CurrentUrl     = "login.m.taobao.com/login.htm?_input_charset=utf-8&sid=",
                index          = 2,
                note           = "登录失败"
            };
            mtbloginEx.OperationHandler += (s, e) => {
                taskRunner.ReportAccount("failed");
                ClearAndPrepareNext();
            };
            //进入搜索页

            //直接跳转
            //Operation gerenzhongxin = new Operation(MainCefFrame) {
            //    PerviousStatus = BusinessStatus.gerenzhongxin,
            //    NextStatus = BusinessStatus.Awp_core_detail,
            //    CurrentUrl = "http://h5.m.taobao.com/awp/mtb/mtb.htm",
            //    index = 2,
            //    note = "跳转到某货"
            //};
            //gerenzhongxin.OperationHandler += (s, e) => {
            //    string shaopaddress = FileHelper.RandomReadOneLine("config//goodaddress.txt");// "http://h5.m.taobao.com/awp/core/detail.htm?id=39552254784&spm=0.0.0.0";
            //    MainCefFrame.LoadUrl(shaopaddress);
            //};

            //跳转到搜索
            Operation act_sale_searchlist = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.gerenzhongxin,
                NextStatus     = BusinessStatus.act_sale_searchlist,
                CurrentUrl     = "h5.m.taobao.com/awp/mtb/mtb.htm",
                index          = 2.1,
                note           = "跳转到搜索页面"
            };
            act_sale_searchlist.OperationHandler += (s, e) => {
                string js2run = beforejs +
                                "window.location=mydoc.getElementsByClassName('search')[0].getElementsByTagName('a')[0].getAttribute('dataurl');";
                CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
            };

            //输入关键字
            Operation search_htm = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.act_sale_searchlist,
                NextStatus     = BusinessStatus.search_htm,
                CurrentUrl     = "m.taobao.com/channel/act/sale/searchlist.html?pds=search",
                index          = 2.21,
                note           = "输入搜索的关键字"
            };
            search_htm.OperationHandler += SearchOneItem;

            //输入关键字2
            Operation search_htm2 = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.act_sale_searchlist,
                NextStatus     = BusinessStatus.search_htm,
                CurrentUrl     = "m.taobao.com/?from=wapp",
                index          = 2.22,
                note           = "输入搜索的关键字"
            };
            search_htm2.OperationHandler += SearchOneItem;
            //跳转到随机一个搜索结果`1
            Operation search_htm2detail = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.search_htm,
                NextStatus     = BusinessStatus.Awp_core_detail,
                index          = 2.31,
                CurrentUrl     = "s.m.taobao.com/h5?q=",
                note           = "跳转到随机一个搜索结果"
            };
            search_htm2detail.OperationHandler += ChooseOneItem;

            //跳转到随机一个搜索结果`2
            Operation search_htm2detail2 = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.search_htm,
                NextStatus     = BusinessStatus.Awp_core_detail,
                index          = 2.32,
                CurrentUrl     = "s.m.taobao.com/search.htm?q=",
                note           = "跳转到随机一个搜索结果"
            };
            search_htm2detail2.OperationHandler += ChooseOneItem;
            //end of 2
            Operation Awp_core_detail = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.Awp_core_detail,
                NextStatus     = BusinessStatus.awp_base_buy,
                CurrentUrl     = "h5.m.taobao.com/awp/core/detail.htm?id=",
                index          = 3,
                note           = "确认下单"
            };
            Awp_core_detail.OperationHandler += (s, e) => {
                int sleepTime = RandomManager.random.Next(2, 8);
                LogManager.WriteLog("暂停{0}秒".With(sleepTime));
                Thread.Sleep(sleepTime * 1000);

                string js2run = beforejs;
                //随机收藏
                if (RandomManager.randomBool())
                {
                    js2run += "mydoc.getElementsByClassName('dts-fav')[0].click();";
                }
                js2run += "window.setTimeout(function(){mydoc.getElementsByClassName('c-btn-orgn dt-immbuy')[0].click();},2000); ";
                CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
                ExtractIfCurrentPage(s);
            };

            Operation awp_base_buy = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.awp_base_buy,
                NextStatus     = BusinessStatus.exCashier,
                CurrentUrl     = "h5.m.taobao.com/awp/base/buy.htm?itemId=",
                index          = 4,
                note           = "提交订单"
            };
            awp_base_buy.OperationHandler += (s, e) => {
                var str = RandomManager.RandomReadOneLine("import//liuyan.txt");
                str = str.ReplaceNum();
                //返回的随机数的下界(随机数可取该下界值)。返回的随机数的上界(随机数不能取该上界值)。
                bool annoymous = RandomManager.random.Next(1, 3) > 1;
                ;
                bool isCurrentPage = false;

                for (int i = 0; i < 3; i++)
                {
                    LogManager.WriteLog("#第{0}次购买".With(i));
                    //
                    string js2run = beforejs + "mydoc.getElementsByClassName('c-form-txt-normal')[1].value='{0}';".With(str);
                    if (annoymous)
                    {
                        js2run += "mydoc.getElementsByName('anonymous')[0].checked=true;";
                    }
                    js2run += "mydoc.getElementsByClassName('submit-only c-btn-oran')[0].click();";
                    CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
                    //
                    //  new Thread(() => {
                    Thread.Sleep(3000);
                    lock (wap_tmp) {
                        //if (!isCurrentPage(s as Operation)) {
                        isCurrentPage = ExtractAndReloadIfCurrentPage(s);
                        //    //不停留在当前页面,则表示没问题
                        //} else {
                        //    LogManager.WriteLog("刷新并等待4秒");
                        //    MainCefFrame.Browser.Reload();
                        //    Thread.Sleep(4000);
                        //}
                    }
                    if (!isCurrentPage)
                    {
                        break;
                    }

                    //  }).Start();
                }
            };

            Operation exCashier = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.exCashier,
                NextStatus     = BusinessStatus.asyn_payment_result,
                CurrentUrl     = "wapcashier.alipay.com/cashier/exCashier.htm?orderId=",
                index          = 4,
                note           = "付款方式1"
            };
            exCashier.OperationHandler += (s, e) => {
                //检查
                //<span class="price">0.01元</span>
                float maxPrice;
                bool  isOverPrice;
                var   priceFloat = PriceFloat(out maxPrice, out isOverPrice);
                if (isOverPrice)
                {
                    LogManager.WriteLog("{0}超出maxPrice:{1},停止购买".With(priceFloat, maxPrice));
                    return;
                }
                //
                //付款
                string js2run = beforejs +
                                "mydoc.getElementById('couponPayment').checked=true;" +
                                "mydoc.getElementsByName('paymentPassword')[0].value='{0}';".With(currentHaoZi.zfbPayPwd) +
                                "mydoc.getElementsByClassName('ui-button ui-button-submit')[0].click();";
                CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
                ExtractIfCurrentPage(s);
            };


            Operation exCashier2 = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.exCashier,
                NextStatus     = BusinessStatus.asyn_payment_result,
                CurrentUrl     = "mclient.alipay.com/w/trade_pay.do?alipay_trade_no=",
                index          = 5,
                note           = "付款方式2"
            };
            exCashier2.OperationHandler += (s, e) => {
                string js2run = beforejs + "mydoc.getElementById('pwd').value='{0}';".With(currentHaoZi.zfbPayPwd) +
                                "mydoc.getElementsByClassName('J-button-submit')[0].click()";
                CefFrameHelper.ExcuteJs(MainCefFrame, js2run);
                ExtractIfCurrentPage(s);
            };

            #region ==========该次购买结束1、2==========
            Operation payok = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.asyn_payment_result,
                NextStatus     = BusinessStatus.TB_shop_V2_Ready,
                CurrentUrl     = "wapcashier.alipay.com/cashier/asyn_payment_result.htm",
                index          = 6.1,
                note           = "该次购买结束1",
            };
            payok.OperationHandler += finishOneShop;
            Operation cashierPay = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.asyn_payment_result,
                NextStatus     = BusinessStatus.TB_shop_V2_Ready,
                CurrentUrl     = "mclient.alipay.com/cashierPay.htm?awid=",
                index          = 6.2,
                note           = "该次购买结束2",
            };
            cashierPay.OperationHandler += finishOneShop;

            //购买失败
            Operation accessDenied = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.asyn_payment_result,
                NextStatus     = BusinessStatus.ready,
                CurrentUrl     = "mclient.alipay.com/accessDenied.htm",
                index          = 6.3,
                note           = "无权访问,重试pay"
            };

            accessDenied.OperationHandler += (s, e) => {
                lock (lockobject) {
                    MainCefFrame.Browser.GoBack();
                    Thread.Sleep(3000);
                    state = BusinessStatus.exCashier;
                    MainCefFrame.Browser.Reload();
                }
            };
            // mclient.alipay.com/accessDenied.htm

            #endregion



            opsList.Add(mtb);
            //  opsList.Add(gerenzhongxin);
            //搜索进店
            opsList.Add(act_sale_searchlist);
            opsList.Add(search_htm);
            opsList.Add(search_htm2detail);
            opsList.Add(search_htm2detail2);
            //end of 搜索进店

            opsList.Add(Awp_core_detail);
            opsList.Add(awp_base_buy);
            opsList.Add(exCashier);
            opsList.Add(exCashier2);

            //
            opsList.Add(payok);      //成功方式一
            opsList.Add(cashierPay); //成功方式二
            opsList.Add(accessDenied);

            //

            opsList.Add(mtbloginEx);
        }
Esempio n. 22
0
        private void InitZfbSQ()
        {
            if (IsInitZfbSQloaded)
            {
                return;
            }


            IsInitZfbSQloaded = true;
            // 导航至添加密保(选择添加密保的方式)
            Operation zfb_reg_queryStrategy = new Operation(MainCefFrame);

            zfb_reg_queryStrategy.index             = 21;
            zfb_reg_queryStrategy.PerviousStatus    = BusinessStatus.zfb_reg_nav2set_add_SecurityQuestion_before;
            zfb_reg_queryStrategy.CurrentUrl        = "https://accounts.alipay.com/console/queryStrategy.htm?site=1&page_type=fullpage&sp=1-addSecurityQuestion-fullpage&scene_code=addSecurityQuestion";
            zfb_reg_queryStrategy.NextStatus        = BusinessStatus.zfb_reg_nav2set_add_SecurityQuestion;
            zfb_reg_queryStrategy.OperationHandler += (s, e) => {
                MainCefFrame.LoadUrl(GlobalVar.zfb_reg_nav2set_SecurityQuestion);
            };

            //导航至支付宝密保
            Operation nav2set_SQ = new Operation(MainCefFrame);

            nav2set_SQ.index             = 22;
            nav2set_SQ.PerviousStatus    = BusinessStatus.zfb_reg_nav2set_add_SecurityQuestion;//
            nav2set_SQ.NextStatus        = BusinessStatus.zfb_reg_nav2set_SecurityQuestion;
            nav2set_SQ.OperationHandler += BT_zfb_reg_nav2set_SecurityQuestion_Click;
            nav2set_SQ.CurrentUrl        = "https://accounts.alipay.com/console/selectStrategy.htm?sp=1-addSecurityQuestion-fullpage&strategy=payment_password";// GlobalVar.zfb_reg_queryStrategy2;

            //填支付密码
            Operation add_SQ = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.zfb_reg_nav2set_SecurityQuestion,
                NextStatus     = BusinessStatus.zfb_reg_add_SecurityQuestion_Fill_PayPwd,
                CurrentUrl     = "https://accounts.alipay.com/console/selectStrategy.htm?sp=1-addSecurityQuestion-fullpage&strategy=payment_password"
                ,
                index = 23
            };

            add_SQ.OperationHandler += BT_zfb_reg_add_SecurityQuestion_Fill_PayPwd_Click;

            //填写安保
            Operation setQa = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.zfb_reg_add_SecurityQuestion_Fill_PayPwd,
                NextStatus     = BusinessStatus.zfb_reg_setQa,
                CurrentUrl     = GlobalVar.zfb_reg_setQa
                ,
                index = 24
            };

            setQa.OperationHandler += BT_zfb_reg_add_SecurityQuestion_Click;

            Operation setQa_confirm = new Operation(MainCefFrame)
            {
                index          = 25,
                PerviousStatus = BusinessStatus.zfb_reg_setQa,
                NextStatus     = BusinessStatus.zfb_reg_add_SecurityQuestion_setQa_confirm,
                CurrentUrl     = GlobalVar.zfb_reg_add_SecurityQuestion_setQa_confirm
            };

            setQa_confirm.OperationHandler += BT_zfb_reg_add_SecurityQuestion_setQa_confirm_Click;

            Operation add_sq_sucess = new Operation(MainCefFrame)
            {
                index          = 26,
                PerviousStatus = BusinessStatus.zfb_reg_add_SecurityQuestion_setQa_confirm,
                NextStatus     = BusinessStatus.zfb_reg_open_tb_before,
                CurrentUrl     = "https://accounts.alipay.com/console/common/success.htm"
            };

            add_sq_sucess.OperationHandler += Add_SQ_SUCESS;
            //

            //=========解绑手机
            Operation nav2jiebang = new Operation(MainCefFrame)
            {
                index          = 3.1,
                PerviousStatus = BusinessStatus.Zfb_reg_shifou_bangding_shouji_before,
                NextStatus     = BusinessStatus.Zfb_reg_shifou_bangding_shouji,
                CurrentUrl     = "https://my.alipay.com/portal/account/index.htm",
                note           = "主页至解绑页"
            };

            nav2jiebang.OperationHandler += (s, e) => {
                var res = CefFrameHelper.GetMsgByJs2(MainCefFrame,
                                                     "document.getElementsByClassName('account-status-det')[2].getElementsByClassName('fn-left')[1].innerText", "gb2312");
                LogManager.WriteLog(res);
                if (!string.IsNullOrEmpty(res) && res.Trim() == "未绑定")  //未绑定
                // state= tb_ TODO:
                {
                    BT_ZFB_REG_nav2addsq_Click(s, e);//导航至添加密保
                }
                else
                {
                    MainCefFrame.LoadUrl("https://accounts.alipay.com/console/dispatch.htm?scene_code=removeMobile&site=1&page_type=fullpage");
                }
            };

            Operation removeMobile0 = new Operation(MainCefFrame)
            {
                index          = 3.2,
                PerviousStatus = BusinessStatus.Zfb_reg_shifou_bangding_shouji,
                NextStatus     = BusinessStatus.Zfb_reg_removeMobile0,
                CurrentUrl     = "https://accounts.alipay.com/console/queryStrategy.htm?site=1&page_type=fullpage&sp=1-removeMobile-fullpage&scene_code=removeMobile",
                note           = "选择解绑方式1-身份证"
            };

            removeMobile0.OperationHandler += (s, e) => {
                MainCefFrame.LoadUrl("https://accounts.alipay.com/console/selectStrategy.htm?sp=1-removeMobile-fullpage&strategy=email-id_card_raw-payment_password");
            };

            //Operation removeMobile0 = new Operation(MainCefFrame) {
            //    index = 3.2,
            //    PerviousStatus = BusinessStatus.Zfb_reg_shifou_bangding_shouji,
            //    NextStatus = BusinessStatus.Zfb_reg_removeMobile0,
            //    CurrentUrl = "https://accounts.alipay.com/console/queryStrategy.htm?site=1&page_type=fullpage&sp=1-removeMobile-fullpage&scene_code=removeMobile",
            //    note = "选择解绑方式2-手机"
            //};
            //removeMobile0.OperationHandler += (s, e) => {
            //    MainCefFrame.LoadUrl("https://accounts.alipay.com/console/selectStrategy.htm?sp=1-removeMobile-fullpage&strategy=sms-payment_password");
            //};

            Operation removeMobile1 = new Operation(MainCefFrame)
            {
                index          = 3.2,
                PerviousStatus = BusinessStatus.Zfb_reg_removeMobile0,
                NextStatus     = BusinessStatus.Zfb_reg_removeMobile1,
                CurrentUrl     = "https://accounts.alipay.com/console/selectStrategy.htm?sp=1-removeMobile-fullpage&strategy=email-id_card_raw-payment_password",
                note           = "输入身份证信息和支付密码"
            };

            removeMobile1.OperationHandler += (s, e) => {
                Thread.Sleep(2000);
                CefFrameHelper.ExcuteJs(MainCefFrame, "document.getElementById('J-certNo').value='{0}';".With(currentHaoZi.zfbSFZ));

                new Thread(() => {
                    #region ---输入支付密码---
                    Thread.Sleep(1000);
                    MouseKeyBordHelper.POINT p1;
                    MouseKeyBordHelper.GetCursorPos(out p1);
                    LogManager.WriteLog("mouse position {0},{1}   ".With(p1.X, p1.Y));
                    LogManager.WriteLog("Form position {0},{1}   ".With(this.Left, this.Top));


                    //int chax = 582 - 110;
                    //int chay = 557 - 110;
                    int chax = ConfigHelper.GetIntValue("取消手机页面左边距");  // 600 - 61;
                    int chay = ConfigHelper.GetIntValue("取消手机页面上边距");  // 562 - 171;

                    Thread.Sleep(1000);
                    MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay);

                    Thread.Sleep(1000);
                    var s1 = currentHaoZi.zfbPayPwd;
                    LogManager.WriteLog(s1);
                    MouseKeyBordHelper.KeyBoardDo(s1.ToCharArray());
                    #endregion

                    //new Thread(() => {
                    //    Thread.Sleep(3000);
                    //CefFrameHelper.ExcuteJs(MainCefFrame,
                    //    "document.getElementById('J-selectStrategyForm').submit();");
                    LogManager.WriteLog("mouse {0},{1}   ".With(p1.X, p1.Y));
                    MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay + ConfigHelper.GetIntValue("取消手机页面待移动距离"));
                    //  }).Start();
                }).Start();
            };

            #region MyRegion
            //Operation removeMobile1 = new Operation(MainCefFrame) {
            //    index = 3.2,
            //    PerviousStatus = BusinessStatus.Zfb_reg_removeMobile0,
            //    NextStatus = BusinessStatus.Zfb_reg_removeMobile1,
            //    CurrentUrl = "https://accounts.alipay.com/console/selectStrategy.htm?sp=1-removeMobile-fullpage&strategy=email-id_card_raw-payment_password",
            //    note = "输入手机验证码和支付密码"
            //};
            //removeMobile1.OperationHandler += (s, e) => {
            //    #region MyRegion
            //    Thread.Sleep(2000);
            //    string js1 = "document.getElementsByClassName('ui-button-text')[0].click();";
            //    CefFrameHelper.ExcuteJs(MainCefFrame,
            //        js1);

            //    new Thread(() => {
            //        #region ---输入支付密码---
            //        Thread.Sleep(1000);
            //        MouseKeyBordHelper.POINT p1;
            //        MouseKeyBordHelper.GetCursorPos(out p1);
            //        LogManager.WriteLog("mouse position {0},{1}   ".With(p1.X, p1.Y));
            //        LogManager.WriteLog("Form position {0},{1}   ".With(this.Left, this.Top));

            //        int chax = 367;
            //        int chay = 403;
            //        Thread.Sleep(1000);
            //        MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay);

            //        Thread.Sleep(1000);
            //        var s1 = currentHaoZi.zfbPayPwd;
            //        LogManager.WriteLog(s1);
            //        MouseKeyBordHelper.KeyBoardDo(s1.ToCharArray());
            //        #endregion

            //        //收验证码
            //        LogManager.WriteLog("之前的号码是 {0} 继续获取".With(GlobalVar.phoneNum));

            //        string vcodeNum = "";
            //        bool isVcodeOk = SmsConfigHelper.GetSmsOfPhone(GlobalVar.phoneNum, ref vcodeNum, SmsServer.zfb_jiebang);

            //        string js2 = "document.getElementById('J-inputCode').value='{0}';".With(vcodeNum);
            //        CefFrameHelper.ExcuteJs(MainCefFrame, js2);


            //        //new Thread(() => {
            //        //    Thread.Sleep(3000);
            //        //CefFrameHelper.ExcuteJs(MainCefFrame,
            //        //    "document.getElementById('J-inputCode').click();");
            //        //    "document.getElementById('J-selectStrategyForm').submit();");
            //        LogManager.WriteLog("mouse {0},{1}   ".With(p1.X, p1.Y));
            //        MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay + 65);
            //        //  }).Start();
            //    }).Start();
            //    #endregion
            //};
            #endregion

            Operation removeMobile2 = new Operation(MainCefFrame)
            {
                index          = 3.3,
                PerviousStatus = BusinessStatus.Zfb_reg_removeMobile1,
                NextStatus     = BusinessStatus.Zfb_reg_removeMobile2,
                CurrentUrl     = "https://accounts.alipay.com/console/common/email/sendSuccess.htm?emailType=securityCheckEmail&emailLogonId=",
                note           = "去邮件完成验证"
            };
            removeMobile2.OperationHandler += (s, e) => {
                //#3.3
                var url = EmailCheck("请完成邮箱验证", "立即解除手机绑定");
                if (!string.IsNullOrEmpty(url))
                {
                    MainCefFrame.LoadUrl(url);
                }
            };
            Operation removeMobile3 = new Operation(MainCefFrame)
            {
                index          = 3.4,
                PerviousStatus = BusinessStatus.Zfb_reg_removeMobile2,
                NextStatus     = BusinessStatus.Zfb_reg_removeMobile3,
                CurrentUrl     = "https://accounts.alipay.com/console/emailSecurityConfirm.htm?activeKey=",
                note           = "点击链接,继续解绑手机"
            };
            removeMobile3.OperationHandler += (s, e) => {
                var js = "window.location=window.frames[0].document.getElementsByClassName('linklist')[0].getElementsByTagName('a')[0].href;";
                CefFrameHelper.ExcuteJs(MainCefFrame, js);
            };
            Operation removeMobile4 = new Operation(MainCefFrame)
            {
                index          = 3.5,
                PerviousStatus = BusinessStatus.Zfb_reg_removeMobile3,
                NextStatus     = BusinessStatus.zfb_reg_nav2set_add_SecurityQuestion_before,
                CurrentUrl     = "https://accounts.alipay.com/console/common/success.htm?sp=1-removeMobile-fullpage&isCancelCard=false&sp=1-removeMobile-fullpage&site=1&scene_code=removeMobile&page_type=fullpage",
                note           = "解绑成功,继续添加密保"
            };
            removeMobile4.OperationHandler += (s, e) => {
                //  var    CurrentUrl = "https://accounts.alipay.com/console/queryStrategy.htm?site=1&page_type=fullpage&sp=1-addSecurityQuestion-fullpage&scene_code=addSecurityQuestion";

                BT_ZFB_REG_nav2addsq_Click(s, e);
                //state = BusinessStatus.zfb_reg_nav2set_add_SecurityQuestion_before;
                //MainCefFrame.LoadUrl(
                //    "https://accounts.alipay.com/console/queryStrategy.htm?site=1&page_type=fullpage&sp=1-addSecurityQuestion-fullpage&scene_code=addSecurityQuestion"

                //    );
                //CurrentUrl = "https://my.alipay.com/portal/account/index.htm",
            };
            //
            Operation taobaoopen = new Operation(MainCefFrame)
            {
                index          = 27,
                PerviousStatus = BusinessStatus.zfb_reg_open_tb_before,
                NextStatus     = BusinessStatus.zfb_reg_taobao_new_alipay_q,
                CurrentUrl     = "https://my.alipay.com/portal/account/index.htm",
                note           = "开通淘宝"
            };

            // BusinessStatus.zfb_reg_taobao_new_alipay_q;
            taobaoopen.OperationHandler += BT_ZFB_REG_TB_open_Click;

            //zfb注册 手机验证


            opsList.Add(nav2jiebang);
            opsList.Add(removeMobile0);
            opsList.Add(removeMobile1);
            opsList.Add(removeMobile2);
            opsList.Add(removeMobile3);
            opsList.Add(removeMobile4);

            //=================

            opsList.Add(zfb_reg_queryStrategy);
            opsList.Add(nav2set_SQ);
            opsList.Add(add_SQ);
            opsList.Add(setQa);
            opsList.Add(setQa_confirm);
            opsList.Add(add_sq_sucess);
            opsList.Add(taobaoopen);
            //
            //添加收货地址
        }