c# - 使用 FlaUI 自动化在 WPF 应用程序中获取进度条的可见性
问题描述
我正在使用FlaUI自动化WPF应用程序。我有一个Inderminate进度条。一旦进度条得到Collapsed,UI就会被加载。我想在 ProgressBar 上实现一种机制,但我无法通过Retry
Visibility
property
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}}" />
我想实现 aRetry.While((LoadingStaus_Is_Collapsed)=> )};
但似乎我无权访问该visibility
属性。我怎样才能完成它?
解决方案
在这里工作的属性是IsOffScreen
。UIA 框架提供此属性,因为 Visibility 是一个WPF
属性,而不是UIA
.
IsOffScreen
如果元素当前不在屏幕上,则返回 True 否则返回False
。这就是我使用它的方式
public bool LoadingStatusVisibiltity()
{
_logger.Info("Retrieving data from the server.Please wait!");
if (LoadingStatus.IsOffscreen)
{
return true;
}
else
{
return false;
}
}
推荐阅读
- java - 无法通过“在数组中出现 y 次后删除 x 元素”的测试用例
- jmeter - 如何在 jmeter 中找到 API 的浏览器渲染时间,包括检索嵌入式资源是否给出了整体响应时间。?
- c - 为什么 fork() 将两个进程中的每个页面都标记为只读?
- r - ggplot geom_bar 在 x 轴上具有单独的分组变量
- javascript - 无法使用 reactjs 将 Javascript 函数写入 Typescript?
- git - 如何在运行时覆盖 Jenkins 用户定义的变量?
- go - Golang:切片并制作
- excel - Excel,删除具有零值的列并绘制1000个点
- javascript - jQuery AJAX 调用以错误的顺序返回图像 - 数据同步
- laravel - 如何从facebook获取名字和姓氏?