private void 分析AToolStripMenuItem_Click(object sender, EventArgs e) { foreach (var page in JianWrapper.GetJian().Pages) { var url = page.Url; foreach (var interest in page.Interests.Keys) { var xpath = page.Interests[interest].Pattern; WebDriverWrapper.GetDriver().Navigate().GoToUrl(url); var wait = new WebDriverWait(WebDriverWrapper.GetDriver(), TimeSpan.FromSeconds(120)); try { wait.Until(d => FindElement(d, xpath)); var element = FindElement(WebDriverWrapper.GetDriver(), xpath); page.Interests[interest].Value = element.Text; } catch (Exception) { page.Interests[interest].Value = "查找失败。(请重试或者在设置中修改特征字符)"; } } } WebDriverWrapper.Close(); JianWrapper.GetJian().SaveToFile(); ReloadSetting(); MessageBox.Show("分析完毕。"); }
private void 保存SToolStripMenuItem_Click(object sender, EventArgs e) { JianWrapper.GetJian().FromDataTable(dg.DataSource as DataTable, false).SaveToFile(); }
private void 保存SToolStripMenuItem_Click(object sender, EventArgs e) { JianWrapper.GetJian().SaveToFile(); }