Fire an event when a div changes by a javascript in a webBrowser1 in a winforms
I have a C# winform app that is collecting some data from console-based commands. After the first step of data collecting is done I open a web browser control and direct it to a flash and javascript-based site that tests the download/upload speed to a server.
After the flash app is done cheking the speed, it updates a <div>
through a javascript call.开发者_如何学C
I am trying to collect the data the flash app sends to the JavaScript. I want to pass it to a string variable inside my winforms app. Is there a way to snap it up as it is passed to the <div>
, or is there a way of reading it in to a variable after it is displayed on the site.
The HTML that calls the script is
</script>
<script type="text/javascript" src="speedtest/functions.js"></script>
<br />
<div id="speed"></div>
The data i want in to my variable is this form the script download_speed and upload_speed.
Any suggestions on how i can do this? i have no control to edit the html og the javascript on the site.
i got it working after the flash start i start a timer that monitors the div and looks for changes
this is a mockup of the code i needed
private void timer1_Tick(object sender, EventArgs e)
{
content = webBrowser1.Document.GetElementById("speed");
string x = content.OuterHtml;
if (x != CheckString)
{
timer1.Enabled = false;
MessageBox.Show(x);
}
}
精彩评论