Skip to content

How to open devtools and keep the focus on console as default #2066

Answered by mdmintz
hiyamandal asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

For 1: Add --devtools as a pytest command-line option to open devtools with the browser. More info here.

For 2: There are methods for that: (See the example test: SeleniumBase/examples/test_console_logging.py)

self.start_recording_console_logs()
"""
Starts recording console logs. Logs are saved to: "console.logs".
To get those logs later, call "self.get_recorded_console_logs()".
If navigating to a new page, then the current recorded logs will be
lost, and you'll have to call start_recording_console_logs() again.
# Link1: https://stackoverflow.com/a/19846113/7058266
# Link2: https://stackoverflow.com/a/74196986/7058266
"""

self.console_log_string(string)
"""
Log a string to the Web…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@hiyamandal
Comment options

@mdmintz
Comment options

@hiyamandal
Comment options

Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants