[英]I am unable to visit the list of WebElements one by one using Selenium WebDriver
[英]I am new to selenium.How should i check a list of webelements(which are numbers) are masked after the 4th character
我如何使用 selenium java 來驗證 data.table 在第 4 個字符后被屏蔽。 我使用下面的代碼從 GUI 中提取 WebElements。 列表 IDds = driver.findElements(By.xpath("//tbody/tr/td[1]"));
數據示例:1111$$$$
2222$$
在循環中找到您需要的所有元素,或者給出一個返回 web 元素列表的 CSS 表達式:
WebElement myElm = driver.findElementByCSS("CSSExpression");
String text = myElm.getAttribute("Text");
// or
// String text = myElm.getAttribute("Value");
Char C = text.charAt(4);
if (C=='$')
// Good
else
// bad
您還可以找到字符串中您看到$
的第一個位置,並確保所有其他字符都相同。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.