LetsPlayYahtzee LetsPlayYahtzee - 4 months ago 22
Python Question

HTML snapshots using the selenium webdriver?

I am trying to capture all the visible content of a page as text. Let's say that one for example.

If I store the page source then I won't be capturing the comments section because it's loaded using javascript.

Is there a way to take HTML snapshots with selenium webdriver?
(Preferably expressed using the python wrapper)


Regardless of whether or not the HTML of the page is generated using JavaScript, you will still be able to capture it using driver.page_source.

I imagine the reason you haven't been able to capture the source of the comments section in your example is because it's contained in an iframe - In order to capture the html source for content within a frame/iframe you'll need to first switch focus to that particular frame followed by calling driver.page_source.