I use a background worker to manipulate some elements of my WebBrowser using vb.net.
For example, a background working RFIDReader will check if I have a specific link.
ElseIf TerminalBrowser.Url.ToString.Contains(baseUrl + "box-office/ticket-verification") And rf_code <> "" Then ' Insert RF Code in "rf_code" hidden text field Me.Invoke(Sub() Me.TerminalBrowser.Document.GetElementById("rf_code").SetAttribute("value", rf_code.ToLower)) End If
What happens if I touch my RFID card. It will include the corresponding value for my rf_code element in my browser.
Now, what I want to do, I want to check if the container itself exists ( synchronize-rfid ) (since it pops up). See Image for reference.

Here is our code for this.
If Me.TerminalBrowser.Document.GetElementById("synchronize-rfid") IsNot Nothing Then ' Code here end if
Link: stack overflow
The problem is that BackgroundWorker does not actually interact with the user interface according to the code above.
Is there any method to determine if this element exists using a background worker?
I think I did it, but it does not work.
Dim synchronize_rfid = Me.Invoke(Sub() Me.TerminalBrowser.Document.GetElementById("synchronize-rfid")) If synchronize_rfid IsNot Nothing Then ' Code here end if
source share