C# IWebDriver 是如何关闭进程中Chrome 占用的内存的
ChromeOptions options1 = new ChromeOptions();// InternetExplorerOptions internetExplorerOptions = new InternetExplorerOptions();
// 不显示浏览器
options1.AddArgument("--headless");
options1.AddArgument("--disable-gpu");
// internetExplorerOptions.
IWebDriver driver = new ChromeDriver(options1);//new EdgeDriver(options1);
driver.Navigate().GoToUrl(url);
var element = driver.FindElement(By.Name("password"));
var _element = driver.FindElement(By.Name("goto"));
element.SendKeys("admin");
_element.Click();
driver.Navigate().GoToUrl(url2);
driver.SwitchTo().Frame("XFrameTablePage");
var element_ = driver.FindElement(By.Name("XForm"));
//Console.WriteLine("5:" + element_.TagName);
// var ele = element_.FindElements(By.TagName("table")).FindElements(By.TagName("tbody")).FindElements(By.TagName("tr")).FindElements(By.TagName("td")).FindElements(By.TagName("table")).FindElements(By.TagName("tbody")).FindElements(By.TagName("tr")).FindElements(By.TagName("td"));
var tbody_element = element_.FindElements(By.TagName("table")).FindElements(By.TagName("tbody")).FindElements(By.TagName("tr")).FindElements(By.TagName("td")).FindElements(By.TagName("table")).FindElements(By.TagName("tbody"));
string sql;
string POF = tbody_element.FindElements(By.TagName("tr")).FindElements(By.TagName("td")).Text;
driver.Close();
driver.Quit();
driver.Dispose();
你可以看看GC垃圾回收机制
2
页:
[1]