[英]How do you invoke a 'Enter' keypress with webkitbrowser?
I am working on a program that will make me to be able to post message in a chatbox on a website without doing the posting manually. 我正在开发一个程序,该程序使我无需手动进行发布即可在网站上的聊天框中发布消息。 I have this code to put the text into the
textbox
: 我有以下代码将文本放入
textbox
:
message = txtMessage.Text;
foreach(Node txt in wb.Document.GetElementsByTagName("textarea"))
{
if(((Element)txt).GetAttribute("Class") == "chat_input")
{
((Element)txt).Focus();
((Element)txt).TextContent = message;
}
}
Website code is: 网站代码为:
<textarea class="chat_input">
Enter text for chat here
</textarea>
All it has a textbox, and not a post button. 它都有一个文本框,而不是一个发布按钮。 It posts the message when you press enter.
当您按Enter键时,它将发布消息。 What I need now, is some code for invoking an enter keypress.
我现在需要的是一些用于调用Enter键的代码。
Does anyone know how to do that? 有谁知道这是怎么做到的吗? And is it even possible?
甚至有可能吗?
Try this 尝试这个
SendKeys.Send("{ENTER}");
More info at: http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send(v=vs.110).aspx 有关更多信息,请访问: http : //msdn.microsoft.com/zh-cn/library/system.windows.forms.sendkeys.send(v=vs.110).aspx
All the best! 祝一切顺利!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.