Replies: 1 comment
-
In a similar case (with check boxes) I use a helper as a workaround: public static void ClickCenter(this AutomationElement elem)
{
Mouse.Click(elem.BoundingRectangle.Center());
}
static void DoCheck(CheckBox cb, bool on = true)
{
if (cb.IsEnabled && (bool)cb.IsChecked != on)
{
try
{
cb.IsChecked = on;
}
catch (InvalidOperationException ex)
{
cb.ClickCenter();
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to automate an application installer using c# and FlaUI v2 (I'm interacting with an installshield wizard). I am able to successfully bring my desired application to the foreground, and seemingly set focus. I then gather all buttons, and prompt if I find a button named 'Next >' (the name I gathered from FlaUInspect v1.3.0)
The prompt occurs indicating a button with the correct name is being found - but the button.click event throws an exception.
FlaUI.Core.Exceptions.NoClickablePointException: Exception of type 'FlaUI.Core.Exceptions.NoClickablePointException' was thrown.
I saw several threads suggesting that you should use Invoke() instead, so I've tried that, but get this exception:
System.InvalidOperationException: Operation is not valid due to the current state of the object.
Can anyone advise on how to actually click the button now that FlaUI has found it?
Code:
using (var automation = new UIA2Automation())
{
var mainWindow = application.GetMainWindow(automation);
}
Messagebox indicating the button is being found:
FlaUInspect output for the button in question:
Apologies, I can't seem to get the formatting to work for my code block...
Beta Was this translation helpful? Give feedback.
All reactions