List of elements
I have some links at the page like:
123test.com/456
abc_test.com/sdfsd
abc_test.org
I have to get all elements which href attribute consists of test word.
I know how to click at such link by given number:
selenium.click("//body/descendant::a[contains(@href,'test')][2]")
This code will click at second link whic开发者_StackOverflow社区h has 'test' in address. But how to get that count of links?
There is function:
get_xpath_count(self,xpath)
"""
Returns the number of nodes that match the specified xpath, eg. "//table" would give
the number of tables.
'xpath' is the xpath expression to evaluate. do NOT wrap this expression in a 'count()' function; we will do that for you.
"""
精彩评论