Skip to content

Commit 988f34d

Browse files
authored
feat: improve printed log lines around the chrome webdriver creation (#61)
This helps to better visualize the progress of how the WebDriver is created and launched.
1 parent c98fe53 commit 988f34d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

html2pdf4doc/html2pdf4doc.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def get_chrome_version() -> Optional[str]:
261261
try:
262262
print( # noqa: T201
263263
"html2pdf4doc: "
264-
"checking if there is Google Chrome for Testing instead of "
264+
"Checking if there is Google Chrome for Testing instead of "
265265
"a normal Chrome available."
266266
)
267267

@@ -302,7 +302,7 @@ def get_inches_from_millimeters(mm: float) -> float:
302302

303303

304304
def get_pdf_from_html(driver: webdriver.Chrome, url: str) -> Tuple[bytes, int]:
305-
print(f"html2pdf4doc: opening URL with ChromeDriver: {url}") # noqa: T201
305+
print(f"html2pdf4doc: Opening URL with ChromeDriver: {url}", flush=True) # noqa: T201
306306

307307
driver.get(url)
308308

@@ -391,7 +391,7 @@ def create_webdriver(
391391
page_load_timeout: int,
392392
debug: bool = False,
393393
) -> webdriver.Chrome:
394-
print("html2pdf4doc: creating ChromeDriver service.", flush=True) # noqa: T201
394+
print("html2pdf4doc: Creating ChromeDriver service.", flush=True) # noqa: T201
395395

396396
path_to_chrome_driver: str
397397
if chromedriver_argument is None:
@@ -446,14 +446,16 @@ def create_webdriver(
446446
# Enable the capturing of everything in JS console.
447447
webdriver_options.set_capability("goog:loggingPrefs", {"browser": "ALL"})
448448

449-
print("html2pdf4doc: creating ChromeDriver.", flush=True) # noqa: T201
449+
print("html2pdf4doc: Creating ChromeDriver.", flush=True) # noqa: T201
450450

451451
driver = webdriver.Chrome(
452452
options=webdriver_options,
453453
service=service,
454454
)
455455
driver.set_page_load_timeout(page_load_timeout)
456456

457+
print("html2pdf4doc: ChromeDriver created.", flush=True) # noqa: T201
458+
457459
return driver
458460

459461

0 commit comments

Comments
 (0)