提交 8d6628cc authored 作者: 孙洁清's avatar 孙洁清

Merge branch 'master' of git.yfzx.zjtys.com.cn:hct/auto-test

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