そこで、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回押したままフォーカスを移動します....何が起こっているのか知っている人はいますか?