Winforms 在firefox中打开并操作web表单
我需要在firefox浏览器中打开winform应用程序的链接。然后我想自动完成表单的输入,比如用户名和密码,并生成一个按钮,比如点击登录按钮提交表单 我目前正在使用Interop.SHDocVw.dll对IE进行同样的思考,但我需要一个firefox实现。 mozilla的broswer有这样的dll吗?我需要开发插件吗?或者我可能不得不使用UI测试框架 谢谢你的回答Winforms 在firefox中打开并操作web表单,winforms,firefox,input,dom-manipulation,Winforms,Firefox,Input,Dom Manipulation,我需要在firefox浏览器中打开winform应用程序的链接。然后我想自动完成表单的输入,比如用户名和密码,并生成一个按钮,比如点击登录按钮提交表单 我目前正在使用Interop.SHDocVw.dll对IE进行同样的思考,但我需要一个firefox实现。 mozilla的broswer有这样的dll吗?我需要开发插件吗?或者我可能不得不使用UI测试框架 谢谢你的回答 Bruno因此我使用Process start启动Firefox: Process.Start("firefox.exe",
Bruno因此我使用Process start启动Firefox:
Process.Start("firefox.exe", "http://www.mywebsite.com");
然后,我使用USER32.DLL查找并关注Firefox窗口:
// Get a handle to an application window.
[DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
// Activate an application window.
[DllImport("USER32.DLL")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
private void btnEnterText_Click(object sender, EventArgs e)
{
var handle = FindWindow("MozillaUIWindowClass", "Environnement de recette 1.4.0.3 - Mozilla Firefox");
SetForegroundWindow(handle);
SendKeys.SendWait(txtEntry.Text);
}
由于spy++,我找到了窗口的类和标题
所以我的问题是转到页面上的下一个输入。。。当我使用此选项时:
SendKeys.SendWait("{TAB}");
当我按TAB键2次时,它会移动焦点。。。。有人知道发生了什么吗