I am using selenium and want to get the source HTML for the elements obtained by find_element_by_〇〇 such as find_element_by_class_name.
I try to get the source with .page_source, but
AttributeError: 'WebElement' object has no attribute 'page_source'
An error like this occurs.
You can get HTML by the following method.
element.get_attribute('innerHTML')
Reference: https://stackoverflow.com/questions/7263824/get-html-source-of-webelement-in-selenium-webdriver-using-python
Recommended Posts