- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试了下面的代码:
using System;
using System.Diagnostics;
using FlaUI.UIA3;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Process[] AllProcesslist = Process.GetProcesses();
foreach (Process Proc in AllProcesslist)
{
if (!String.IsNullOrEmpty(Proc.MainWindowTitle) && Proc.MainWindowTitle == "Movies & TV")
{
Console.WriteLine("Window Found!");
var app = new FlaUI.Core.Application(Proc);
using (var automation = new UIA3Automation())
{
var window = app.GetMainWindow(automation);
var elem = window.FindFirstDescendant(cf => cf.ByAutomationId("ProgressSlider"));
Console.WriteLine(elem);
elem.Patterns.Scroll.Pattern.SetScrollPercent(20, -1);
}
}
}
Console.Read();
}
}
}
但它返回 FlaUI.Core.Exceptions.PatternNotSupportedException: 'The requested pattern 'Scroll [#10004]' is not supported'
,我使用了 FlaUInspect 然后我意识到它只支持 ScrollItem 和 RangeValue,所以我将 elem.Patterns.Scroll.Pattern.SetScrollPercent(20, -1)
更改为 elem.Patterns.ScrollItem.Pattern.SetScrollPercent(20, -1)
但是有没有 SetScrollPercent。
我怎样才能使它自动化?
最佳答案
我使用 RangeValue
而不是 ScrollItem
,现在它可以正常工作了!
using System;
using System.Diagnostics;
using FlaUI.UIA3;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Process[] AllProcesslist = Process.GetProcesses();
foreach (Process Proc in AllProcesslist)
{
if (!String.IsNullOrEmpty(Proc.MainWindowTitle) && Proc.MainWindowTitle == "Movies & TV")
{
Console.WriteLine("Window Found!");
var app = new FlaUI.Core.Application(Proc);
using (var automation = new UIA3Automation())
{
var window = app.GetMainWindow(automation);
var elem = window.FindFirstDescendant(cf => cf.ByAutomationId("ProgressSlider"));
elem.Patterns.RangeValue.Pattern.SetValue(64);
Console.WriteLine(elem.Patterns.RangeValue.Pattern.Value);
}
}
}
Console.Read();
}
}
}
关于c# - 使用 FlaUI 为电影和电视设置滚动百分比,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65249749/
我正在尝试自动化电影和电视流程 slider 我尝试了下面的代码: using System; using System.Diagnostics; using FlaUI.UIA3; namespac
我是 FLAUI 和自动化测试的新手,想用它来测试我的系统。目前我正在使用 Thread.Sleep() 等待应用程序启动,然后找到登录文本框。有没有比使用 Thread.Sleep() 更有效的方法
我们有一些 UI 测试使用 FlaUI自动与 Windows UI 交互。 当我们在构建服务器上运行这些测试时,除非有人通过 RDP 连接,否则它们无法与 UI 交互。 我们从测试中得到的错误只是 C
我遇到了一个不常发生的问题。我正在尝试使用 FlaUI 和 SpecFlow 自动执行 UI 测试。我正在尝试启动应用程序 exe。应用程序运行了一段时间然后抛出错误。 我收到以下错误。 System
我是一名优秀的程序员,十分优秀!