예제 #1
0
        public override async Task <ConfigurationData> GetConfigurationForSetup()
        {
            var loginPage = await RequestWithCookiesAsync(LandingUrl);

            var parser      = new HtmlParser();
            var dom         = parser.ParseDocument(loginPage.ContentString);
            var qCaptchaImg = dom.QuerySelector("img#regimage");

            if (qCaptchaImg != null)
            {
                var captchaUrl           = qCaptchaImg.GetAttribute("src");
                var captchaImageResponse = await RequestWithCookiesAsync(captchaUrl, loginPage.Cookies, RequestType.GET, LandingUrl);

                var captchaText  = new StringConfigurationItem("Captcha Text");
                var captchaImage = new DisplayImageConfigurationItem("Captcha Image")
                {
                    Value = captchaImageResponse.ContentBytes
                };

                configData.AddDynamic("CaptchaText", captchaText);
                configData.AddDynamic("CaptchaImage", captchaImage);
            }
            else
            {
                logger.Debug($"{Id}: No captcha image found");
            }

            return(configData);
        }
 /// <param name="instructionMessageOptional">Enter any instructions the user will need to setup the tracker</param>
 public ConfigurationDataCaptchaLogin(string instructionMessageOptional = null)
 {
     Username      = new StringConfigurationItem("Username");
     Password      = new StringConfigurationItem("Password");
     CaptchaImage  = new DisplayImageConfigurationItem("Captcha Image");
     CaptchaText   = new StringConfigurationItem("Captcha Text");
     CaptchaCookie = new HiddenStringConfigurationItem("Captcha Cookie");
     Instructions  = new DisplayInfoConfigurationItem("", instructionMessageOptional);
 }