Home > other >  get the value of the td tag
get the value of the td tag

Time:09-24

i need to extract the value of the TD class but unable to extract it

below is my html.

Html Code

what I tried below

elems = driver.find_elements_by_xpath("//td[contains(@class, 'day disabled fullcap alertClasstext') and contains(@title,'Slots Full')]")
for elm in elems:
  print(elm.text)

it is not printing any value. i need the values like 23,24,... etc...

CodePudding user response:

In your case you can get the value of a perticular <td> tag by using innerHTML

elems = driver.find_elements_by_xpath("//td[contains(@class, 'day disabled fullcap alertClasstext') and contains(@title,'Slots Full')]")
for elm in elems:
    print(elm.innerHTML)

CodePudding user response:

Try a little bit of a detailed xpath, and see if this works.

elems = driver.find_elements_by_xpath("//table[@class=' table-condensed']//tr/td[@class='day disabled fullcap alertClasstext']")
for elm in elems:
  print(elm.text)
  • Related