Question webbrowser returnes "Nothing" when try to set a value into a DOM textarea object

jrivera

New member
Joined
Jul 21, 2011
Messages
2
Programming Experience
1-3
webbrowser returnes "Nothing" when try to set a value into a DOM textarea object

Hello, I am writing a VB.Net application which will open a web browser in a form and then set a multiline value into a DOM object.My problem starts when I am trying to assign the value to the object, like this:element = form.webbrowswer1.Document.getElementById("textAreaObjectID")element.SetAttribute("value",stringVariable)But when debugging, element is NOTHING, thus the SetAttribute statement fails.Does anyone knows what the correct way to refer to a object would be with vb.net??
 
Hello again, I reposted my issue when trying to set a value into a textarea object that's in an external website...

I just created a small VBA application for Excel, in which I intend to recreate the scenario that I posted above in my original post.

===>>>The code I wrote in VBA for excel, is the following, I just ran it and it works perfectly:

Set vfilter = oBrowser.document.getElementsByTagName("textarea")
If Not vfilter Is Nothing Then
MsgBox "OuterHTML: " & vfilter(0).outerHTML
MsgBox "Name: " & vfilter(0).Name
MsgBox "ID: " & vfilter(0).ID
MsgBox "TagName: " & vfilter(0).tagName
vfilter(0).Value = stringVariable
End If

===>>> The code below is the one I wrote in the VB.net IDE (visual studio) 2010, which is not working, it is not finding the <textarea> object and returns a count of zero (0) in the collection object:
Dim eColl As HtmlElementCollection
Dim eInput As HtmlElement

eColl = websiteForm.WebBrowser1.Document.GetElementsByTagName("TEXTAREA")
For Each eInput In eColl --->>> the application never enters to the for loop, since eCall is empty, the count is zero.
If eInput.Name = "textAreaObj" Then
eInput.SetAttribute("value", stringVariable)
MsgBox("Object found")
End If
Next eInput

It is very strange that it does recognize the <TEXTAREA> object with VBA for Excel, but it does not with VB.net in from the IDE.
---Can anyone give me a clue as to where I should take a look at? Maybe I am overlooking a step so I can actually fetch the textarea object with vb.net.
 
Back
Top