我正在使用Selenium和chromedriver结合HTML Agility Pack来爬取一组数据,但当我试图导航到此页面时,URL会从url1变成了url2。因此,有没有一种方法可以阻止这种情况发生?
string url = "";
Console.WriteLine("Web Crawler!");
Console.WriteLine("Enter URL :");
url = Console.ReadLine();
Console.WriteLine("Entered URL :" + url);
// selenium section
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.geolocation", 2);
IWebDriver driver = new ChromeDriver(".", chromeOptions);
driver.Navigate().GoToUrl(url);