I am using this for get a row in a table:
element = browser.find_element_by_xpath("//*[contains(text(),'Sample Text')]")
html_text = element.get_attribute('outerHTML')
this gives me <td>...</td>
but I want <tr><td>...</td><td>...</td></tr>
How do I do this?
If you want to get outerHTML of parent element, you can use below
html_text = element.find_element_by_xpath('..').get_attribute('outerHTML')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With