Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Zendriver doesn't properly wait for targets to be updated #90

Open
ccev opened this issue Mar 3, 2025 · 0 comments
Open

Bug: Zendriver doesn't properly wait for targets to be updated #90

ccev opened this issue Mar 3, 2025 · 0 comments

Comments

@ccev
Copy link

ccev commented Mar 3, 2025

Looking into issue #82 I noticed that when changing targets, zendriver won't properly wait for chrome to return the response events.

Browser._handle_target_update handles the TargetInfoChanged, TargetCreated and TargetDestroyed events in the background (given that config.autodiscover_targets is enabled). However, when calling Tab.close, for example, it will only call the cdp.target.close_target method without waiting for any response. For subsequent actions, zendriver will now choose the old, now destroyed target as the connection, which will cause an infinite wait for a response.

It seems that the original author tried to circumvent this issue by adding hard-coded sleep in certain areas, for example in Browser.get, but not in all places where the target may be changed. For obvious reasons, this is not an ideal solution, but adding a sleep to all of these methods may be a viable band-aid fix for this issue.

I think that this is a flaw in zendriver. Ideally, target changes should always be awaited for.

(Remember that enabling debug logs will delay the process enough for the issue to disappear. I was able to easily reproduce this with the code snippet provided in #82)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant