How do I verify an xPath expression in Selenium IDE?
How would I test for the following expression in Selenium?
not(//select[@id='ddlCountry']/@clas开发者_StackOverflows) or
not(contains(//select[@id='ddlCountry']/@class,'invalidValue'))
true if the class attribute doesnt exist, or if it does, the attribute doesn't contain invalidValue
.
I've tried using the verifyElementPresent
command, but it errors out, I assume because I'm returning a boolean rather than a node.
I'm happy with an alternative to this if theres no way to do the above using xPath.
In case your XPath engine API doesnt allow expressions returning atomic values (not nodes), then you still can
Use:
//select[@id='ddlCountry'][contains(@class,'invalidValue')]
and test if an element was selected or not.
true if the class attribute doesnt exist, or if it does, the attribute doesn't contain
invalidValue
.
not(//select[@id='ddlCountry']/@class[contains(.,'invalidValue')])
精彩评论