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

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -