public override void ActivateBulletin(FirefoxDriver driver, TaskInstanceActivationCache taskModel) { try { var inactivePage = @"www.avito.ru/profile/items/inactive"; if (!Auth(driver, taskModel.Login, taskModel.Password)) { return; } WaitPage(driver, 3000, inactivePage); WaitExecute(driver); var idPattern = ".*?_(\\d+)$"; var id = RegexHelper.GetValue(idPattern, taskModel.Url); SendMessage($"ActivateBulletins => Trying to activate bulletin with Id {id}"); //https://www.avito.ru/account/pay_fee?item_id=1717723420&vas_from=item_self_user var activationLink = @"http://www.avito.ru/packages/put_free_package?item_id=" + id; driver.Navigate().GoToUrl(activationLink); WaitExecute(driver); } catch (Exception ex) { } }
static void TestInstanceActivate() { var avito = new Avito(); var task = new TaskInstanceActivationCache { Login = "******", Password = "******", Url = @"https://www.avito.ru/podolsk/telefony/apple_iphone_6_16gb_zolotoy_1717723420" }; FirefoxHelper.ExecuteWithVisual(browser => { browser.Navigate().GoToUrl("https://www.avito.ru/moskva/bytovaya_elektronika"); avito.ActivateBulletin(browser, task); }, null, 100); }
private TaskInstanceActivationCache ToCache7(Task arg2) { var arg1 = new TaskInstanceActivationCache(); var access = BCT.Context.BulletinDb.Accesses.Find(arg2.AccessId.Value); if (access != null) { arg1.Login = access.Login; arg1.Password = access.Password; } var instance = BCT.Context.BulletinDb.BulletinInstances.Find(arg2.InstanceId.Value); if (instance != null) { arg1.Url = instance.Url; arg1.InstanceId = instance.Id; } return(arg1); }