提交 71253f52 authored 作者: 黄承天's avatar 黄承天

完成遍历测试执行类与方法

上级 3243a3a7
......@@ -412,22 +412,26 @@ public class SeleniumExecutor {
}
private Boolean elementMatch(WebElement webElement, Element element) {
boolean attributesMatch = element.attributes().asList().stream()
.allMatch(attribute -> Objects.equals(attribute.getValue(), webElement.getAttribute(attribute.getKey())));
boolean tagMatch = Objects.equals(webElement.getTagName(), element.tagName());
boolean textMatch = Objects.equals(webElement.getText(), element.text());
if (element.attributes().isEmpty()) {
if (element.hasText()) {
return tagMatch && textMatch;
} else {
return tagMatch;
}
} else {
if (element.hasText()) {
return attributesMatch && tagMatch && textMatch;
try {
boolean attributesMatch = element.attributes().asList().stream()
.allMatch(attribute -> Objects.equals(attribute.getValue(), webElement.getAttribute(attribute.getKey())));
boolean tagMatch = Objects.equals(webElement.getTagName(), element.tagName());
boolean textMatch = Objects.equals(webElement.getText(), element.text());
if (element.attributes().isEmpty()) {
if (element.hasText()) {
return tagMatch && textMatch;
} else {
return tagMatch;
}
} else {
return attributesMatch && tagMatch;
if (element.hasText()) {
return attributesMatch && tagMatch && textMatch;
} else {
return attributesMatch && tagMatch;
}
}
} catch (StaleElementReferenceException e) {
return false;
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论