I need help either fixing this error or possible getting the "Start Viewer" button clicked a different way.
private void button1_Click(object sender, EventArgs e)
{
{
webBrowser1.Navigate(new Uri(textBox1.Text));
HtmlDocument doc = webBrowser1.Document;
HtmlElementCollection classButton = webBrowser1.Document.All;
foreach (HtmlElement element in classButton)
{
if (element.GetAttribute("className") == "titre_12")
{
element.InvokeMember("click");
}
}
}
{
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Interval = 1000; // 1 second
timer1.Start();
label2.Text = counter.ToString();
}
}
I am getting "A first chance exception of type 'System.NullReferenceException' occurred in VPS Web Bot.exe"
For the line...
HtmlElementCollection classButton = webBrowser1.Document.All;
I am trying to simply have my bot click to start a viewer but the HTML does not have an ID so I am trying to get my element by class.
I am trying to have it click "Start Viewer" on https://www.websyndic.com/wv3/?qs=MTAzMDE5Nw==
I am self taught when it comes to programming so I don't always understand the proper terms. I apologize in advance.
My post was marked as a duplicate but the post it was referred to is something I already tried and it did not work.