We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e355e2d commit 526f70eCopy full SHA for 526f70e
examples/cdp_mode/raw_save_as_pdf.py
@@ -0,0 +1,12 @@
1
+import base64
2
+from seleniumbase import SB
3
+from selenium.webdriver.common.print_page_options import PrintOptions
4
+
5
+with SB(uc=True, test=True, ad_block=True) as sb:
6
+ url = "https://seleniumbase.io"
7
+ sb.activate_cdp_mode(url)
8
+ sb.reconnect() # To access WebDriver methods
9
+ print_options = PrintOptions()
10
+ pdf_base64 = sb.driver.print_page(print_options)
11
+ with open("downloaded_files/sb.pdf", "wb") as f:
12
+ f.write(base64.b64decode(pdf_base64))
0 commit comments