using System; using FaucetCollector.Script; public class litecoinfaucetScript : FaucetScript { public override FaucetSettings Settings { get { return new FaucetSettings("https://allcoins.pw/faucet.php?coin=PPC") { //Setting for EmailAddress for allcoins.pw new FaucetSetting() { Name = "EmailAddress", Display = "EmailAddress", Type = EditorType.TextBox, Required = true }, //Setting for Password for allcoins.pw new FaucetSetting() { Name = "Password", Display = "Password", Type = EditorType.Password, Required = true }, //Option to use SolveMedia or reCAPTCHA new FaucetSetting() { Name = "UseSolveMedia", Display = "Use SolveMedia", Type = EditorType.CheckBox, Default = true } }; } } public override void Start() { Title = "Allcoins.pw"; SuccessXPath = "//p[starts-with(text(),'Your actual Balance')]"; FailXPath = "//div[contains(@class,'alert-warning')]"; base.Start(); } public override bool IsLoggedIn() { return IsVisible(ElementByXPath("//a[contains(@href, '/logout.php')]")); } public override int BeforeLogin() { return base.BeforeLogin(); } public override int DoLogin() { GoToUrl("https://allcoins.pw/"); Wait(5); var loginPanelBtn = ElementByXPath("//a[@href='#'][contains(text(),'Login')]"); Click(loginPanelBtn); Wait(2); var c = ElementByXPath("//div[@id='register']//div[@class='modal-dialog modal-dialog-centered']//div[@class='modal-content']//div[@class='modal-footer']//button[@id='swlogin']"); if (IsVisible(c)) { Click(c); } Wait(2); var logInUser = ElementByXPath("//*[@id='lem']"); if (!IsVisible(logInUser)) { } var logInPassword = ElementByXPath("//*[@id='lpw']"); if (!IsVisible(logInPassword)) { return Fail("Password input not found."); } SetText(logInUser, GetSetting("EmailAddress")); Wait(); SetText(logInPassword, GetPassword("Password")); var loginButton = ElementByXPath("//*[@id='login']//button[@class='btn btn-primary']"); if (!IsVisible(loginButton)) { return Fail("Login button not found."); } var captc = ElementByXPath("//label[@for='captchal']"); var box = ElementByXPath("//input[@id='captchal']"); var result = DoSolveImageCaptcha(captc, box); if (result > 0) { return Fail("Captcha failed"); } Wait(); Click(loginButton); return base.DoLogin(); } public override int AfterLogin() { return base.AfterLogin(); } public override int GetFaucetWaitTime() { var waitElement = ElementByXPath("//span[@id='claim']"); if (!IsVisible(waitElement)) { //no time remaining element, so we are good to go. return 0; } var waitText = waitElement.Text.ToLower().Trim().Replace("you can claim in ", "").Replace(" seconds","").Trim(); if(waitText == "claim !") { //no time remaining element, so we are good to go. return 0; } int seconds = 0; if (!int.TryParse(waitText, out seconds)) { return Fail("Unable to get the remaining time from text '" + waitText + "'."); } //return the total wait time in seconds return seconds; } public override int BeforeSolveCaptcha() { //select the right option for captcha var solveMediaCaptchaDiv = ElementByXPath("//*[@id='captcha1']"); var reCaptchaDiv = ElementByXPath("//*[@id='captcha2']"); var switchCaptchaBtn = ElementByXPath("//a[contains(@onclick, 'swc()')]"); if (GetBoolSetting("UseSolveMedia")) { if(reCaptchaDiv != null && IsVisible(reCaptchaDiv)) { if(switchCaptchaBtn != null && IsVisible(switchCaptchaBtn)) { Click(switchCaptchaBtn); } else { Fail("Switch not found"); } } } else { if(solveMediaCaptchaDiv != null && IsVisible(solveMediaCaptchaDiv)) { if(switchCaptchaBtn != null && IsVisible(switchCaptchaBtn)) { Click(switchCaptchaBtn); } else { Fail("Switch not found"); } } } Wait(); return base.BeforeSolveCaptcha(); } public override int DoSolveCaptcha() { //check for the custom captcha image var captchaImage = ElementByXPath("//*[@id='login']//label/img/.."); if (IsVisible(captchaImage)) { //get the input where the result of the captcha needs to be entered. var captchaInput = ElementByName("captchal"); if (!IsVisible(captchaInput)) { return Fail("ImageCaptcha input field not found"); } //We can use this method to let Faucet Collector solve the image captcha and put the result into the captchaInput element var sleep = DoSolveImageCaptcha(captchaImage, captchaInput); if (sleep > 0) { return sleep; } //return we are done. return 0; } else { //Let Faucet Collector continue. It will check for SolveMedia and reCAPTCHA. return base.DoSolveCaptcha(); } } public override int AfterSolveCaptcha() { return base.AfterSolveCaptcha(); } public override int BeforeSolveFaucet() { return base.BeforeSolveFaucet(); } public override int DoSolveFaucet() { GoToUrl("https://allcoins.pw/faucet.php?coin=PPC"); var claimBtn = ElementByXPath("//*[@id='claimb']"); //if claimBtn is clicked and the captcha failed var captchaResolvedBtn = ElementByXPath("//button[@type='submit' and contains(@class,'btn-primary')]"); if (!IsVisible(claimBtn)) { if(!IsVisible(captchaResolvedBtn)) { return Fail("Claim button not visible."); } } Click(claimBtn); Wait(5); //get the captchaResolved button after claimBtn click captchaResolvedBtn = ElementByXPath("//button[@type='submit' and contains(@class,'btn-primary')]"); if (!IsVisible(captchaResolvedBtn)) { return Fail("Captcha is Resolved button not visible."); } //Solve the captcha var result = SolveCaptcha(); if (result > 0) { return result; } Wait(3); Click(captchaResolvedBtn); return base.DoSolveFaucet(); } public override int AfterSolveFaucet() { return base.AfterSolveFaucet(); } public override int CheckFaucetResult() { var result = base.CheckFaucetResult(); //if (IsSuccess) //{ // // Reload = true; //} return result; } }