How can i get the value of term_from and term_to from this html table.

enter image description here


If I understand you correctly, you know that your table row has the attributes term_from and term_to and you are interested in their values?
getAttribute on the element should to the trick. See here for the Java API: https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/WebElement.html#getAttribute(java.lang.String)

Edit: A bit more concretely in Python, assuming that driver is your webdriver instance, let's print out these attributes for every row:

table_body = driver.get_element_by_id("bertListTableBody")
rows = table_body.get_element_by_tag_name("tr")
for row in rows:
    print("term_from: ", row.get_attribute("term_from"))
    print("term_to: ", row.get_attribute("term_to"))


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.