我正在尝试验证文本“提供的信息无效或不完整”.在
Java中使用Selenium / WebDriver显示.
我有以下HTML:
- required: Server Name
- required: Receiving Port
使用以下CSS代码:
#validationError:before {
content: 'The information provided is either invalid or incomplete.';
}
这是我目前的java代码:
WebElement errorBox = browser.findElement(By.id("validationError"));
Assert.assertNotNull("Could not find validation errors",errorBox);
System.out.println("Error Explanation: " + error.getCssValue("content") + "\n");
List errorList = errorBox.findElements(By.tagName("li"));
for (WebElement error : errorList) {
System.out.println("Error: " + error.getText());
}
System.out.println("\nError Full Text: " + errorBox.getText());
这是我输出的上述代码:
Error Explanation:
Error: required: Server Name
Error: required: Receiving Port
Error Full Text: required: Server Name
required: Receiving Port
我似乎无法找到验证文本的方法“提供的信息无效或不完整.”被展示.在web元素上调用getText()也不会返回预期的字符串,但会在该div中显示任何其他普通文本.有任何想法吗?