c# - 如何解决此错误 stale element reference: element is not attach to the page document
问题描述
请查找附件代码:
IWebElement webElement = this.wait.Until<IWebElement>(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Id("search-for-deals-results")));
if (webElement != null)
{
ReadOnlyCollection<IWebElement> elements = webElement.FindElements(By.XPath("tbody//tr//a[contains(@href,'public/dealList')]"));
this.issuerList = new List<FileData>();
foreach (var data in elements.Select(l => new
{
link = l.GetAttribute("href"),
name = l.Text
}))
this.issuerList.Add(new FileData()
{
Name = data.name,
Url = data.link
});
this.dealsList = new List<FileData>();
if (!string.IsNullOrEmpty(issueName))
this.issuerList = this.issuerList.Where<FileData>((Func<FileData, bool>) (s => s.Name.Contains(issueName))).ToList<FileData>();
Console.WriteLine("Download Process Started: " + DateTime.Now.ToShortTimeString());
this.ProcessIssures(this.issuerList, false);
Console.WriteLine("fdfs" + this.dealsList.Count.ToString());
this.ProcessIssures(this.dealsList, true);
}
}
Download.driver.Quit();
解决方案
推荐阅读
- c++ - 在 Lambda 中捕获后移动 std::unique_str
- sql - 如何在此数字语句中获取 Null
- oracle - 无法连接数据库 SQLdeveloper oracle xe 版本
- graphql - 如何修复站点地图错误?
- java - 批处理语句与多值插入
- pandas - 在迭代数据框时,如何将新找到的值放入同一索引处的新列中?
- microsoft-graph-api - Microsoft Graph API findMeetingTimes 端点返回不正确的响应
- logic - 需要帮助了解 unordered_map 的两种用法之间的区别
- r - 在 dplyr 的汇总函数中使用过滤器函数
- bash - 为什么 Git Bash vs msys2 git 抛出不同的 git 状态?