简体   繁体   中英

Print HTML text of a selenium webelement in Python

I am using Selenium webdriver in Python for a web-scraping project.

How to print the HTML text of the selenium.WebElement ?

I intend to use the BeautifulSoup to parse the HTML to extract the data of interest.

Thanks

It's not possible to get the raw HTML from a WebElement .

You can get the page source from the browser object though: browser.page_source .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM