我要在此Website上设置文字
及其相对html
<textarea ng-model="textarea" allow-tab="" open-url="" character-count="" bind-input="update_contents();" ng-change="update_contents();" class="textarea ng-pristine ng-valid ng-not-empty ng-touched" spellcheck="false" placeholder="" style="font-size: 15px; height: 183.2px;"></textarea>
如果该textarea的值未出现在html中,如何更改它的值?我正在使用网络浏览器控件
谢谢
答案 0 :(得分:0)
您需要使用以下方法获取HtmlElement:
没有任何ID,因此排除了数字1。我个人将使用数字3,并使用一些调试技巧来确定数组中的哪一项是您所需的TextArea。
一旦有了HtmlElement,就可以将其InnerText属性设置为所需的值。
以下是演示您想要的示例:
Dim textareas = WebBrowser1.Document.GetElementsByTagName("textarea")
If (textareas.Length > 0) Then
' this assumes that the first item in the array is the desired TextArea, you may need to change the index
textareas(0).InnerText = "hello world"
End If