I have the following Xpath expression:
//*[not(input)][ends-with(@*, \'Copyright\')]
I expect it to give me all elements - except input - w
I don't know Selenium but if //*[not(input)][starts-with(@*, 'Copyright')]
is parsed successfully and if additionally the XPath 2.0 function ends-with
is supported then I don't see any reason why //*[not(input)][ends-with(@*, 'Copyright')]
is not accepted as a legal expression. Your verbal description however sounds as if you want //*[not(self::input)][@*[ends-with(., 'Copyright')]]
.
//*[not(input)]
selects any elements not having any input child element while //*[not(self::input)]
selects any elements not being themselves input
elements. As for comparing [@*[ends-with(., 'Copyright')]]
with what you have, my suggestion is true as long as there is any attribute node which ends with 'Copyright' while your test would only work if there is a single attribute which ends with 'Copyright', as ends-with http://www.w3.org/TR/xquery-operators/#func-ends-with allow a sequence with a single item as its first argument or an empty sequence but not several items.