Skip to content

Commit 2fef71a

Browse files
committed
fix browser page logging
1 parent 1f7efab commit 2fef71a

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

tests/test_app/tests/utils.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,8 @@ def start_playwright_client(cls):
117117
cls.browser = cls.playwright.chromium.launch(headless=bool(headless))
118118
cls.page = cls.browser.new_page()
119119
cls.page.set_default_timeout(10000)
120-
cls.page.on("console", cls.playwright_logging)
121-
122-
@staticmethod
123-
def playwright_logging(msg):
124-
if msg.type == "error":
125-
_logger.error(msg.text)
126-
elif msg.type == "warning":
127-
_logger.warning(msg.text)
128-
elif msg.type == "info":
129-
_logger.info(msg.text)
120+
cls.page.on("console", lambda msg: print(f"{msg.type.upper()}: {msg.text}"))
121+
cls.page.on("pageerror", lambda err: print(f"ERROR: {err.name}: {err.message}"))
130122

131123
@classmethod
132124
def shutdown_playwright_client(cls):

0 commit comments

Comments
 (0)