Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[🚀 Feature]: [py] Use daemonic threads in WebSocket connections #16294

@cgoldberg

Description

@cgoldberg

Description

The Python bindings use threads in 2 places in the WebSocket class (in py/selenium/webdriver/remote /websocket_connection.py), for starting the WebSocket and for executing callbacks.

The threads are not started as "daemon threads".

From the Python docs:

"A thread can be flagged as a “daemon thread”. The significance of this flag is that the entire Python program exits when only daemon threads are left."

The consequence of this is that a program can't be terminated if the WebSocket connection has not been closed and all callbacks are not complete. This might be annoying if you just want to abruptly exit and don't care about connections that are still open.

To change this behavior, we can add the daemon=True argument in the 2 places we instantiate the Thread class.

Have you considered any alternatives or workarounds?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-devtoolsIncludes everything BiDi or Chrome DevTools relatedC-pyPython BindingsI-enhancementSomething could be better

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions