Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Object reference null on webbrowser's radio button

I am attempting to select a radial button on a webpage through webbrowser using

Code
       Dim checkB As HtmlElement

       checkB = WebBrowser1.Document.GetElementById("offerListInput_-1595316507")

       checkB.SetAttribute("checked", True)

however I keep getting object reference null and I cannot figure out why. The only thing I can figure is maybe the website isn't loaded when it does this, and if so, how can I tell it to load the page before it occurs? I already have another one using

Code
Public Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

to tell me when the page is loaded so it can press a button, and i've tried doing it again but it will not allow it. I've also tried using a goto statement but it will not recognize it in another sub.


I'm stuck, can anyone assist me?

Basically i'm trying to load a webpage, check if it's loaded, press a button, check if it's loaded, select a radial option, see if it's loaded, and then input more data.
It means that checkB is null, because the specified element couldn't be found.

So when you try to access checkB, you get the exception because, it is, null.

Consider using an organized package like HtmlAgilityPack.
I'm not sure why it would be null, that's what the elementID is called so i'm confused
Make sure the element id is correct, also check if the element accept true and false or have dedicated type.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by AeS0pDec 21, 2020 06:19 AM 0 199 Dec 21, 2020 06:19 AM
Last Post: AeS0p
[C] by saltycrackerMay 29, 2020 04:36 AM 0 138 May 29, 2020 04:36 AM
Last Post: saltycracker
[.NET] by LeonieHackPetaBytes2Jan 23, 2019 05:10 PM 1 226 Jan 23, 2019 05:10 PM
Last Post: 0xDEAD10CC