|
-
Sep 10th, 2022, 06:54 PM
#1
Thread Starter
Member
Vb.net document.getelementbyid() not working with chromium
The new code I tried didn't seem to work so I'm looking for guidance on how my VB code setup for an IE browser can be converted to work in Chromium:
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Value.Text = Value.Text - 1
If Value.Text = 0 And
WebBrowser1.DocumentText.Contains(User.Text) Then
WebBrowser1.Document.GetElementById("msg").InnerText = R1.Text
WebBrowser1.Document.GetElementById("submit").InvokeMember("Click")
Value.Text = 240
LatestActivity.Text = (DateTime.Now.ToString())
End If
End Sub
The new code I've started with is simply:
Code:
browser.ExecuteScriptAsync("document.GetElementById('message').InnerText;" = R1.Text)
But I unfortunately had no luck with it so any guidance is greatly appreciated.
Last edited by nitrozity; Sep 10th, 2022 at 07:10 PM.
-
Sep 10th, 2022, 11:38 PM
#2
Re: Vb.net document.getelementbyid() not working with chromium
This code:
vb.net Code:
browser.ExecuteScriptAsync("document.GetElementById('message').InnerText;" = R1.Text)
is equivalent to this:
vb.net Code:
Dim flag As Boolean = ("document.GetElementById('message').InnerText;" = R1.Text)
browser.ExecuteScriptAsync(flag)
That's clearly not what you want. I'm guessing that you actually want to execute that script and get the text result, then compare that to R1.Text, so do that. Also, if you're calling ExecuteScriptAsync then that's going to return a Task, so you probably need to await it or get the Result. You ought to look at existing examples of that method and see how they do it.
-
Sep 11th, 2022, 03:21 AM
#3
Thread Starter
Member
Re: Vb.net document.getelementbyid() not working with chromium
Thanks for your answer. I had the original code working fine with the built-in IE browser, but that only lasted so long since it's quite outdated by now. Is there a simpler way I can just translate my original code to work with Chromium?
-
Sep 12th, 2022, 08:39 PM
#4
Thread Starter
Member
Re: Vb.net document.getelementbyid() not working with chromium
Bump, still looking for assistance. TIA.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|