gpt4 book ai didi

selenium-webdriver - 如何使用Selenium WebDriver验证页面中存在的行数

转载 作者:行者123 更新时间:2023-12-02 04:56:06 25 4
gpt4 key购买 nike

我有一个页面,其中存在行数并且它是动态的。
我想验证显示1到18行的文本。
但这不应该硬编码。
它应该返回存在的实际行数。

最佳答案

由于您已经提到了语言,因此我在C#中为您提供了示例,您可以执行以下操作

IWebElement location = Browser.Driver.FindElement(table locator));
ReadOnlyCollection<IWebElement> totalRow = location.FindElements(By.TagName("tr"));

将给出当前的行数
totalRowtotalRow.Count;

如果您还有其他帮助,请告诉我

关于selenium-webdriver - 如何使用Selenium WebDriver验证页面中存在的行数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22197540/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com