I am trying to get the value of a CSS attribute "content" with:
WebElement plusOrMinusSign = currentEntityTypeLevel1.findElement(
By.xpath("i[@class='tree-branch-head']::after"));
System.out.println(plusOrMinusSign.getCssValue("content"));
However, I get an error: The string 'i[@class='tree-branch-head']::after' is not a valid XPath expression.
It seem the "::after
" is not recognised.
Html:
<i class="tree-branch-head" ng-class="iBranchClass()" ng-click="selectNodeHead(node)">::after
</i>
Css:
i:after {
content: "-";
}
Any idea how to get the value of "content"?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…