本文介绍了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 - 在不断增长的页面上查找元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
The End


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)