F
Flair2016
Guest
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
webBrowser1.Document.GetElementById("event-more-view-3813947").InvokeMember("click");
}
private void button2_Click(object sender, EventArgs e)
{
string str = webBrowser1.Document.Body.Parent.OuterHtml;
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(str);
if (doc != null)
{
var Text2 = doc.DocumentNode.SelectNodes("//tr[@class=market-details-3813947]");
foreach (var c in Text2)
{
textBox1.Text += c.InnerHtml;
}
}
}
I want to get HTML page from "tr". But at first, I have to click on an element to make the script run, after that the table with "tr" that I need, is shown and I can get my text...
The problem is, that I want to do it step by step, not buy pressing 2 buttons.
If I call code inside of button2_Click() from webBrowser1_DocumentCompleted, it doesnt work, because Browser need some time to run the script. And Sleep(time), doesnt help. The Browser getting freez for some time and after that, script runs.
How can I solve this problem?
Continue reading...
{
webBrowser1.Document.GetElementById("event-more-view-3813947").InvokeMember("click");
}
private void button2_Click(object sender, EventArgs e)
{
string str = webBrowser1.Document.Body.Parent.OuterHtml;
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(str);
if (doc != null)
{
var Text2 = doc.DocumentNode.SelectNodes("//tr[@class=market-details-3813947]");
foreach (var c in Text2)
{
textBox1.Text += c.InnerHtml;
}
}
}
I want to get HTML page from "tr". But at first, I have to click on an element to make the script run, after that the table with "tr" that I need, is shown and I can get my text...
The problem is, that I want to do it step by step, not buy pressing 2 buttons.
If I call code inside of button2_Click() from webBrowser1_DocumentCompleted, it doesnt work, because Browser need some time to run the script. And Sleep(time), doesnt help. The Browser getting freez for some time and after that, script runs.
How can I solve this problem?
Continue reading...