我试图使用Eclipse中的Selenium提交按钮自动化工作流。检查字符串的外观(并提取)数字值
我使用的是自定义函数waitForVisible
检查,如果WebElement
ID为“naviInfo”显示,如果它拥有具有或者“没有行被发现”或消息“未找到{number}行”的消息。
问题是我无法排序和检查文本的数字部分。下面给出了示例代码。
String message = waitForVisible(By.id("naviInfo")).getText();
if ("No rows were found".equals(message)) {
log.info("No rows were found after submit");
}
else if ("**1804** rows were found".equals(message)) {
log.info("**1804** rows found after submit");
}
else {
(other error checks)
}
我该如何检查在找到普通文本行之前是否有数字值?另外还将这个数字保存到一个变量?
谢谢kaqqao。你的评论确实帮助我弄清楚我需要什么。 – Nitya