Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 600
Kiran Avatar asked Nov 29 '11 18:11

Kiran


1 Answers

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.

like image 56
Acorn Avatar answered Sep 28 '22 16:09

Acorn