java - how to use the count() function to get an element with a specific number of inner tags -
i using java , selenium write test. in dom, have 2 svg
tags. 1 of them has more 2 inner path
tags. need svg
used:
wait.until(expectedconditions.presenceofelementlocated(by.xpath( "//*[local-name() = 'svg' , count(.//path)>'2']")));
or
wait.until(expectedconditions.presenceofelementlocated(by.xpath( "//*[local-name() = 'svg'] [count(.//path)>'2']")));
but doesn't work. need know what's wrong please offer other ways around. thanks.
by way worked for:
//*[local-name() = 'svg' , count(.//*[local-name() = 'path' ])>'1']
or
//*[local-name() = 'svg'][ count(.//*[local-name() = 'path' ])>'1']
the problem trying find .//path
svg element. far know, cannot because svg elements different namespace. mentioned in question, can fix using [local-name() = 'path' ]
. workaround using jsexecutor execute method document.evaluate()
can specify namespace of svg. see example @ post.
Comments
Post a Comment