Using the selenium
module, how do I dump the current page's HTML (for debugging purposes)? It doesn't say how to here: http://selenium-python.readthedocs.io/api.html
Asked
Active
Viewed 1,305 times
3

James Ko
- 32,215
- 30
- 128
- 239
-
this helps you? https://stackoverflow.com/questions/25356440/need-to-dump-entire-dom-tree-with-element-id-from-selenium-server – Tales Pádua Apr 02 '18 at 20:36
2 Answers
3
For debugging purpose to dump the current page's HTML you can invoke the page_source
method as :
driver.page_source

undetected Selenium
- 183,867
- 41
- 278
- 352
2
You can dump the current page's HTML content using the WebDriver
property page_source
.
Sample snippet:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('https://yourfavoriteurl')
if 'interested_string' in driver.page_source:
print('String matched!')

Swadhikar
- 2,152
- 1
- 19
- 32