c# - PowerShell Selenium 代码等待元素属性具有特定值
问题描述
在 PowerShell 代码中,我需要等到 Web 元素的属性更改其值。我正在使用 PowerShell 和 Selenium WebDriver 编写自动化测试。当我按下视频播放器的播放按钮时。VideoLoaded div 的 aria-valuenow 属性将其值从 0 更改为其他值。我需要WebDriver等到div的aria-valuenow属性值不等于0。
以下是用 C# 编写的相同代码的示例,但我不知道如何在 PowerShell 中编写它。
waitForElement.Until((Driver) => Driver.FindElement(By.CssSelector("div[class='loaded']")).GetAttribute("aria-valuenow") != "0");
我已经编写了以下 powershell selenium webdriver 代码来等待使用预期的条件元素是可点击的,但无法找到一种方法来完成等待属性值更改的方法。请帮忙。谢谢
$seleniumWait.Until([OpenQA.Selenium.Support.UI.ExpectedConditions]::ElementToBeClickable([OpenQA.Selenium.By]::XPath("//span[text()='Recognise the importance of air']")));
解决方案
推荐阅读
- elasticsearch - 根据响应值计算 Prometheus 中的可用性
- javascript - 使用 Javascript 实现自动化
- ios - 动画子视图 AutoLayout 约束更改
- loops - 获取一个循环以显示从 2048 到 1 的 2 的所有幂,显示 2048、1024、512、...、1
- node.js - Node.js 中的同步 api 调用
- powershell - “-split” - 从“-stream”输出?
- glassfish-4 - 启动 GlassFish 4.0 时无法找到或加载主类 Files.Microsoft
- oracle - 计算两个字段之间的日期
- mysql - 在 MySQL 中转换日期
- android - 我可以根据我的应用主题为我的应用中的所有 AppBarLayout 设置样式吗?