public static List <string> GetAll(SiteDriver driver, string pagingPattern, int startPage) { var list = new List <string>(); int currentPage = startPage; while (true) { var currentUrl = pagingPattern.Replace("$PAGE$", currentPage.ToString()); Log($"-> {currentUrl}"); driver.Navigate(currentUrl); try { var gp1 = driver.GetElementsBySelector("tr.spy1x td[colspan]:first-child .spy14"); if (gp1 == null || gp1.Length < 1) { Log("Страница не имеет прокси"); break; } var gp2 = driver.GetElementsBySelector("tr.spy1xx td[colspan]:first-child .spy14"); var tmp = gp1.Concat(gp2); list.AddRange(tmp.Select(x => x.Text)); } catch { break; } currentPage++; } return(list); }
public void Run(ref SiteDriver driver) { foreach (var action in Actions) { action.Run(ref driver); } }
public static SiteDriver Create() { var tmp = new SiteDriver(); tmp.driver = new ChromeDriver(); return(tmp); }
private void Button1_Click(object sender, EventArgs e) { List <string> proxyList = new List <string>(); using (var tmpDriver = SiteDriver.Create()) { Log("Получение списка прокси..."); proxyList = ProxyGrabber.GetAll(tmpDriver, "http://spys.one/proxies/$PAGE$/", 0); var len = proxyList.Count; if (len > 0) { Log($"Прокси получены ({len} шт.)"); SetDisplay(textBox3); foreach (var item in proxyList) { Log(item); } SetDisplay(textBox2); } else { Log($"Не удалось получить список прокси"); } } var driver = SiteDriver.Create(proxyList); }
public static SiteDriver Create(List <string> proxyList) { var tmp = new SiteDriver(); tmp.driver = new ChromeDriver(); // todo add proxy return(tmp); }
public void Run(ref SiteDriver driver) { }