save the webpage #2391
slvamegestic
started this conversation in
General
Replies: 1 comment 1 reply
-
Basic example of saving HTML into a file: from seleniumbase import SB
with SB(browser="chrome") as sb:
sb.open("data:text/html,<div>Hello<br><input></div>")
source = sb.get_page_source()
sb.save_data_as(source, "page_source.html", "./")
from seleniumbase import SB
with SB(browser="chrome") as sb:
sb.open("data:text/html,<div>Hello<br><input></div>")
source = sb.driver.page_source
sb.save_data_as(source, "page_source.html", "./") For any other ways of getting the page source, try Stack Overflow. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can I save the webpage as a single html file?
above code only saves the html string instead of css styles. i need to extract the exact html with styles. Do any idea how to achieve this selenium base?
I am using selenium base with python3
Beta Was this translation helpful? Give feedback.
All reactions