1

Is there a structure below that I need to get the value of the tag between>

For example

driver.find_element_by_xpath (u '//span[contains(text(),"name")]')

HTML

<span itemprop="name">Colombia U20 vs Ukraine U20</span>
Fabiano Carvalho
  • 504
  • 1
  • 6
  • 17

1 Answers1

3

Try the following xpath.

driver.find_element_by_xpath('//span[contains(text(),"Colombia U20 vs Ukraine U20")]').text

OR

driver.find_element_by_xpath('//span[contains(.,"Colombia U20 vs Ukraine U20")]').text

OR

driver.find_element_by_xpath('//span[@itemprop="name"]').text

If you want to use css selector try that.

driver.find_element_by_css_selector('span[itemprop="name"]').text
KunduK
  • 32,888
  • 5
  • 17
  • 41