private void KeyInput(string placeholder,string struserinfo)
{
if (Index == 0 || Index == 5)
{
webBrowser1.Document.GetElementsByTagName("input")[2].SetAttribute("type", "password");//设置密码模式
}
//寻找所有输入标签
var inputs = webBrowser1.Document.GetElementsByTagName("input").Select(p => p as Gecko.DOM.GeckoInputElement).Where(p => p.GetAttribute("placeholder") == placeholder);
foreach (var input in inputs)
{
var curInput = input /*as Gecko.DOM.GeckoInputElement*/;
#region
DomEventArgs ev = webBrowser1.Document.CreateEvent("KeyEvents");
var webEvent = new Event((mozIDOMWindowProxy)webBrowser1.Window.DomWindow, ev.DomEvent as nsISupports);
webEvent.InitEvent("focus", true, false);
curInput.GetEventTarget().DispatchEvent(ev);
var keyEvent = new KeyEvent((mozIDOMWindo
Geckofx60 模拟键盘输入
这篇博客详细介绍了如何在C#中利用Geckofx60库模拟键盘输入,为Firefox应用程序提供自动化测试和交互功能。
摘要由CSDN通过智能技术生成