private void button1_Click(object sender, EventArgs e)
{
browser.Load($"https://kad.arbitr.ru/Card?number={textBox1.Text}");
MessageBox.Show("Делаю...");
Parce();
}
private void WebBrowserFrameLoadEnded()
{
browser.ViewSource();
html = browser.GetSourceAsync().Result;
}
private void InitializeChromium()
{
CefSettings settings = new CefSettings();
Cef.Initialize(settings);
browser = new ChromiumWebBrowser("https://kad.arbitr.ru/Card/ae47ff72-5db0-481e-b44a-b9f8c2d889ae");
// Controls.Add(browser);
// browser.Dock = DockStyle.Fill;
}
private void Parce()
{
try
{
WebBrowserFrameLoadEnded();
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(html);
HtmlNodeCollection node = doc.DocumentNode.SelectNodes("//*[@id='gr_case_partps']/table/tbody/tr/td[1]/div/ul/li/span/a");
Plaintiffs.Text = "Истцы:\n" + node[0].InnerText.Replace(" ", "");
node = doc.DocumentNode.SelectNodes("//*[@id='gr_case_partps']/table/tbody/tr/td[2]/div/ul/li/span/a");
defendant.Text = "Ответчики:\n" + node[0].InnerText.Replace(" ", "");
node = doc.DocumentNode.SelectNodes("//*[@id='chrono_list_content']/div/div/div[1]/div[2]/h4/span[2]/span/a");
judje.Text = "Суд:\n" + node[0].InnerText.Replace(" ", "");
}
catch(Exception EXCEPTION)
{
MessageBox.Show(EXCEPTION.Message);
}
}
System.NullReferenceException: "Object reference not set to an instance of an object."
node было null.
node = doc.DocumentNode.SelectNodes("//*[@id='b - container']/div[1]/dl/dt/span");
Cause.Text = "Причина:\n" + node[0].InnerText;
https://kad.arbitr.ru/Card?number={textBox1.Text}