我可以确定click
来电是否成功?我调试了一个点击按钮的应用程序(见下面的代码),有时似乎没有这样做,我会帮助确定点击是否成功。
HtmlElement button = ...;
IHTMLElement nativeElement = button.DomElement as IHTMLElement;
nativeElement.click();
答案 0 :(得分:0)
您是否考虑为该特定HTMLElement的click事件添加事件处理程序?你可以沿着这些方向做点什么:
bool shouldfire = false;
bool didFire = false;
private void yourMethod()
{
HtmlElement button = ...; //however you are getting this element
button.Click +=button_Click;
IHTMLElement nativeElement = button.DomElement as IHTMLElement;
nativeElement.click();
shouldfire = true;
}
private void button_Click(object sender, HtmlElementEventArgs e)
{
didFire = true;
}
private void yourOtherMethod()
{
if (shouldfire != didFire)
{
//do something
}
}