使用FlaUI Automation在WPF应用程序中获取进度条的可见性 [英] Getting the visibility of a progress bar in a WPF application using FlaUI Automation
问题描述
我正在使用 FlaUI 自动化 WPF 应用.我有一个进度栏,它是 Inderminate .进度栏获得合拢后,即会加载 UI .我想在ProgressBar Visibility
上实现Retry
机制,但无法通过FlaUI
I am automating a WPF app using FlaUI. I have a progressbar that is Inderminate. Once the progressbar gets Collapsed, The UI is loaded. I want to implement a Retry
mechanism on the ProgressBar Visibility
but I am not able to find the correct property
through FlaUI
private ProgressBar LoadingStatus => _uiAutomation.FindElement("ShowProgress", Automation.FindBy.Id).AsProgressBar();
<ProgressBar AutomationProperties.AutomationId="ShowProgress"
Grid.Row="1"
Height="4"
Margin="0"
BorderThickness="0"
IsIndeterminate="True"
IsTabStop="False"
ToolTip="Contacting Server, Please Wait..."
Visibility="{Binding IsServerActive, Converter={StaticResource MwBoolToVisibilityConverterReverse}}" />
我想实现Retry.While((LoadingStaus_Is_Collapsed)=> )};
,但似乎我无权访问visibility
属性.
我该怎么办?
I want to implement a Retry.While((LoadingStaus_Is_Collapsed)=> )};
but seems like I don't have access to the visibility
property.
How can I get it done?
推荐答案
在这里起作用的属性是IsOffScreen
. UIA框架提供此属性,因为可见性是WPF
属性而不是UIA
.
如果元素当前不在屏幕上,则IsOffScreen
返回True,否则返回False
.
这就是我的用法
The property that works here is IsOffScreen
. The UIA framework provides this property as Visibility is a WPF
property and not UIA
.
IsOffScreen
returns True if the element is not currently on the screen else returns False
.
This is how I used it
public bool LoadingStatusVisibiltity()
{
_logger.Info("Retrieving data from the server.Please wait!");
if (LoadingStatus.IsOffscreen)
{
return true;
}
else
{
return false;
}
}
这篇关于使用FlaUI Automation在WPF应用程序中获取进度条的可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!