vb.net - Web 自动化 - 如何将文本输入到由类定义的网站 (textarea) 上的富文本框中?
问题描述
我已经尝试了几天,完全被卡住了。如果有人可以帮助我,我将不胜感激;我正在使用 VB.NET。
HTML 代码:
<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"> alt="Send" width="66" height="66" border="0">
</a>
</td>
</tr>
</tbody>
我需要输入的文本框就是这个位
<textarea class="chat-message-input"></textarea>
预先感谢您提供的任何帮助
解决方案
您选择元素,然后根据需要更改 .innertext 属性。
有多种方法可以做到这一点,我不能给你一个例子,因为我不知道你在使用什么也不知道整个 html,但例如它可能看起来像这样:
WebBrowser1.Document.GetElementById("someid").InnerText="Sometext"
首先,您可以尝试查看您获得的元素集合的外观,然后您应该能够弄清楚下一步该做什么。
Dim test = WebBrowser1.Document.GetElementsByTagName("textarea")
例如在此页面上:
Dim test = WebBrowser1.Document.GetElementsByTagName("tbody")
test(1).InnerText = "Hi there"
推荐阅读
- javascript - 如何在ajax调用后重新加载img attr“src”而不知道图像标签中的文件名?
- javascript - 使用角度4删除对象数组中的重复项
- java - 向 k8s 提交 spark 作业时 trustAnchors 参数必须为非空
- javascript - 如何防止在 MVC5 中的页面刷新时显示 javascript 警报消息?
- node.js - 在没有端口映射的情况下运行节点 Docker
- c# - Why did fluent assertion fail but Assert passed for an enum?
- c - 添加二进制字符串时结果不正确
- mips - 试图理解 SYSCALL 5 示例,文字 % 占位符的顺序令人困惑
- ruby-on-rails - 导轨 5.2 | Select2 多个逗号分隔的参数
- javascript - 本机反应中的数字总和