public static void scrape() { ScrapingBrowser browser = new ScrapingBrowser(); WebPage homePage = browser.NavigateToPage(new Uri("http://www.bing.com/")); PageWebForm form = homePage.FindFormById("sb_form"); form["q"] = "scrapysharp"; form.Method = HttpVerb.Get; WebPage resultsPage = form.Submit(); HtmlNode[] resultsLinks = resultsPage.Html.CssSelect("div.sb_tlst h3 a").ToArray(); WebPage blogPage = resultsPage.FindLinks(By.Text("romcyber blog | Just another WordPress site")).Single().Click(); }
// https://www.drf.com/live_odds/winodds/track/GG/USA/11/D public void TestBing() { ScrapingBrowser browser = new ScrapingBrowser(); //set UseDefaultCookiesParser as false if a website returns invalid cookies format //browser.UseDefaultCookiesParser = false; WebPage homePage = browser.NavigateToPage(new Uri("http://www.bing.com/")); PageWebForm form = homePage.FindFormById("sb_form"); form["q"] = "scrapysharp"; form.Method = HttpVerb.Get; WebPage resultsPage = form.Submit(); HtmlNode[] resultsLinks = resultsPage.Html.CssSelect("div.sb_tlst h3 a").ToArray(); WebPage blogPage = resultsPage.FindLinks(By.Text("romcyber blog | Just another WordPress site")).Single().Click(); }