Selenium Java. Finding an element with a complex Xpath -
i'm having trouble finding element in table. site finance.yahoo.com/q/ks?s=goog
i'm trying find element named "market cap (intraday)" have id, need other elements in table , not. i've traced xpath think this
//table[@id='yfncsumtab']/tbody/tr[2]/td[1]/table[2]/tbody/tr/td/table/tbody/td[1]/td[2]/span
however, it's not spitting out amount. i'm getting no_such_element exception (it's not finding it)
is xpath correct? or there more streamlined way find element?
i can't technically go class names because can change stock
you got typo. correct xpath is:
//table[@id='yfncsumtab']/tbody/tr[2]/td[1]/table[2]/tbody/tr/td/table/tbody/tr[1]/td[2]/span
your last part had td should have been tr.
an easy way debug using chrome developer tools, see is there way xpath in google chrome?
Comments
Post a Comment