I save site links with the following code, but in some sites, I encounter the following error:
OpenQA.Selenium.StaleElementReferenceException: "stale element reference: element is not attached to the page document (Session info: chrome=xx.x.xxx.xx)"
problem with (this site): https://namnak.com
private string followlinks(string url)
{
IWebDriver driver = new ChromeDriver(@"C:\");
driver.Navigate().GoToUrl(url);
//...
//...
//...
foreach (var item in driver.FindElements(By.TagName("a")))
{
var url2 = item.GetAttribute("href");
//...
}