C# Selenium - Finding Element On Continuously Growing Page(C# Selenium - 在不断增长的页面上查找元素)
问题描述
我正在尝试找到比使用更好的方法:
I am trying to find a better way to do this than using:
js.ExecuteScript("scroll(0, 1300)");
我有一个页面,其中的数据可以更改,从而使页面高度的大小向上或向下变化.所以当我今天去点击一个位于 1500px 的元素时,明天它可能是 800px 并且找不到该元素并且测试用例失败.
I have a page where the data can change making the page height change up or down in size. So when I go to click on an element today that is located at 1500px, tomorrow it may be 800px and the element will not be found and the test case fails.
那么你们用什么来定位页面上大小发生变化的元素?
So what have you guys used to locate elements on a page where the size changes?
推荐答案
我开始使用下面的,似乎运行良好.感谢大家的帮助.
I started using the below which seems to be working nicely. Thanks for the help all.
IWebElement bio = SeleniumDriver.FindElement(By.XPath("path"));
Actions actions = new Actions(SeleniumDriver);
actions.MoveToElement(bio);
actions.Perform();
这篇关于C# Selenium - 在不断增长的页面上查找元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C# Selenium - 在不断增长的页面上查找元素
基础教程推荐
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
