Hello i am trying to send a key to browser using the code below, the new chrome window opens for me but it does not send the key to the browser.
When i debugged i found out chrome process does not have any title name how can i solve this problem?
Process.Start("chrome.exe", "https://labs.sketchfab.com/sculptfab/");
System.Threading.Thread.Sleep(2000);
foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses())
{
if (p.ProcessName == "chrome" && p.MainWindowTitle == "SculptFab - SculptGL + Sketchfab" &&
p.MainWindowHandle != IntPtr.Zero)
{
System.Threading.Thread.Sleep(2000);
for (int i = 0; i < 50; i++)
{
KeyHandle.SetForeGround(p.MainWindowHandle);
SendKeys.Send("s");
System.Threading.Thread.Sleep(2000);
}
}
}
In the above mentioned page when "S" is pressed on the keyboard it zooms out of the object i want too achieve this using my C# code