How can i get the value of term_from and term_to from this html table.
1 Answer 1
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"))
-
Welcome. What would the python answer be? Because the OP is using python, not Java. I'd also recommend reviewing sqa.stackexchange.com/help/how-to-answerLee Jensen– Lee Jensen2021年05月04日 14:16:22 +00:00Commented May 4, 2021 at 14:16