Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 6f5d68b

Browse files
committed
Add: Print JavaScript logs.
1 parent cf19cd8 commit 6f5d68b

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

runestone/shared_conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ def selenium_driver(selenium_driver_session):
4747

4848
yield driver
4949

50+
# Print the logs -- see the setup in `selenium_logging <selenium_logging>`.
51+
print(
52+
"\n"
53+
"JavaScript console logs\n"
54+
"======================="
55+
)
56+
logs = driver.get_log('browser')
57+
for log in logs:
58+
print(f'{log["level"]}: {log["message"]}')
59+
print("\n")
60+
5061
# Clear as much as possible, to present an almost-fresh instance of a browser for the next test. (Shutting down then starting up a browser is very slow.)
5162
driver.execute_script("window.localStorage.clear();")
5263
driver.execute_script("window.sessionStorage.clear();")

0 commit comments

Comments
 (0)