Struggling with inputting text into a richtextbox on a website with VB.NET web automation

  • Thread starter Thread starter oofoof
  • Start date Start date
O

oofoof

Guest
If someone could please help, I have tried a lot but it just is not working. I need to input text into a rich text box on a website defined as a class. Here is the HTML code

<tbody>

<tr>

<td class="chat-attachment-cell"><a href="#" id="attachment-link" class="attachment-link"></a></td>

<td class="chat-input-cell">

<textarea class="chat-message-input"></textarea>

</td>

<td class="chat-send-cell"><a href="#" class="chat-send-button"><img src="https://images-na.ssl-images-amazon...uttons/button-send-disabled._CB212523629_.gif" alt="Send" width="66" height="66" border="0">

</a>

</td>

</tr>

</tbody>


The rich text box is this bit of HTML


<textarea class="chat-message-input"></textarea>


I have tried these solutions, none worked

Dim allelements1 As HtmlElementCollection = WebBrowser4.Document.All
For Each webpageelement As HtmlElement In allelements1
If webpageelement.GetAttribute("value") = "chat-message-input" Then

webpageelement.InvokeMember("click")

webpageelement.SetAttribute("value", "example")
End If
Next


Dim Elems As HtmlElementCollection = WebBrowser4.Document.GetElementsByTagName("chat-input-row")

For Each elem As HtmlElement In Elems

If elem.GetAttribute("className") = "chat-message-input" Then

elem.InvokeMember("click")

elem.SetAttribute("className", "example1")



End If


For Each webpaggelement As HtmlElement In allelements

If webpaggelement.GetAttribute("name") = "chat-input-cell" Then

webpaggelement.InvokeMember("click")

End If
Next


Dim theElementCollection As HtmlElementCollection = WebBrowser4.Document.GetElementsByTagName("textarea")

For Each curElement As HtmlElement In theElementCollection

Dim controlName As String = curElement.GetAttribute("class").ToString

If controlName = "chat-message-input" Then

curElement.InvokeMember("click")

curElement.SetAttribute("Value", "Some description")

curElement.InnerText = "mycontent"


End If

Next

Continue reading...
 
Back
Top