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 e2e0695 commit 6a043d8Copy full SHA for 6a043d8
examples/cdp_mode/raw_print_to_pdf.py
@@ -1,12 +1,10 @@
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:
+with SB(uc=True, test=True, pls="none") 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))
+ sb.assert_title("SeleniumBase Docs")
+ file_path = "downloaded_files/sb.pdf"
+ sb.print_to_pdf(file_path)
+ sb.assert_downloaded_file("sb.pdf")
+ sb.assert_pdf_text(file_path, "SeleniumBase")
0 commit comments