Share via


How to get the value of GetElementById in WebView : Vb.Net

Question

Wednesday, October 30, 2019 1:06 AM

In Webrowser this how i get the value of elementById

 doc = WebBrowser1.Document
 Dim ss as string = doc.GetElementById("cX_l").GetAttribute("VALUE")

How can i do that using WebView in Vb.Net

Thanks

All replies (5)

Wednesday, October 30, 2019 1:16 AM

/dotnet/framework/winforms/controls/how-to-access-the-html-source-in-the-managed-html-document-object-model


Wednesday, October 30, 2019 3:02 AM

Hi,

Someone has encountered same question, you can check following link to refer to.

[redacted]

Hope it can help you.

Best Regards,

Julie

MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].


Saturday, November 2, 2019 2:43 AM

Sorry Julie.

I had to remove your link to that webpage. It was a commercial product and NOT related to the question. You can reform the link below and see for yourself. 

 

www.essential[A].com/forum/[B]_Get-Element-by-ID-from-WebView.aspx

 

[A] = objects

[B] = postst8506

 

Please be careful to only post links for Microsoft products and websites. We cannot endorse third party products, or link to websites that are for non-Microsoft products. Fissues will confirm.

 

Lovin your work otherwise though,
Pete

#PEJL
Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over to TechNet Wiki, for future generations to benefit from! You'll never get archived again, and you could win weekly awards!

Have you got what it takes to become this month's TechNet Technical Guru? Join a long list of well known community big hitters, show your knowledge and prowess in your favoured technologies!


Monday, December 30, 2019 5:52 PM

I forgot to answer my own question. It's really important. If someone ran into the same issue.

Here is how its done:

 Dim ss As String = Await WebView1.InvokeScriptAsync("eval", New String() {"document.getElementById('cX_l').value;"})


Monday, December 30, 2019 6:20 PM

I forgot to answer my own question. It's really important. If someone ran into the same issue.

Here is how its done:

 Dim ss As String = Await WebView1.InvokeScriptAsync("eval", New String() {"document.getElementById('cX_l').value;"})

If you were to ensure the element was found

e.g. Dim functionString = String.Format("document.getElementsById('cX_l')[0].value;")

What is the variable ss returning ?

Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

NuGet BaseConnectionLibrary for database connections.

StackOverFlow