I'm aware of selenium (but for some reason, the real page that has a complex HTML, I couldn't retrieve it well using DOM, so I eventually give up - I'm trying luck with FlaUI). To start out, I'm trying some simple task such as open a page and click on a button. But it isn't working. It didn't result in any error, the application seems to just hangs. What am I missing?
my code:
var process = Process.Start(@"C:\Program Files\Mozilla Firefox\firefox.exe",
"file:///C:/Users/jckj33/Desktop/button.html");
//process.WaitForInputIdle();
var app = FlaUI.Core.Application.Attach(process.Id);
Debug.WriteLine("wating...");
app.WaitWhileBusy();
Debug.WriteLine("waiting done!!");
Thread.Sleep(5000);
using (var automation = new UIA3Automation())
{
var window = app.GetMainWindow(automation);
var button = window
.FindFirstDescendant(cf => cf.ByControlType(FlaUI.Core.Definitions.ControlType.Button))
.AsButton();
button?.Invoke();
}
where button.html is:
<input type='button' value='Click me' onclick='alert("hello, world!")'>