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 - 在不断增长的页面上查找元素
基础教程推荐
- SSE 浮点算术是否可重现? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 如何激活MC67中的红灯 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01