C#硒 - 寻找元素在不断增长的页 [英] C# Selenium - Finding Element On Continuously Growing Page

查看:113
本文介绍了C#硒 - 寻找元素在不断增长的页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一个更好的方法,这样做比使用:

I am trying to find a better way to do this than using:

js.ExecuteScript("scroll(0, 1300)");



我有一个页面,该数据可以改变使页面高度更改或大小了。所以,当我走到今天这位于 1500px ,明天元素上点击它可能是 800像素和元素将不会被发现和测试例失败。

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#硒 - 寻找元素在不断增长的页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆