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

[java] Ensure calling close() and quit() done cause BiDi websocket errors #13333

Merged
merged 4 commits into from
Dec 20, 2023

Conversation

pujagani
Copy link
Contributor

Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

Fixes #13316
If the BiDi capability is passed, then WebDriver that implements HasBiDi interface, which will create the websocket connection for BiDi. So, on WebDriver quit(), those resources do need the clean up.

Motivation and Context

If WebDriver close() is called, it closes the session if it is the last browsing context. It also closes the WebSocket.
If WebDriver quit() is called after, it also tries to close an already closed websocket. The changes fix that.
This measure is needed until "session.end" from BiDi is implemented by the browsers, which can then be used to close the BiDi session. Similar, to what we do we CDP and dettach target.

Additionally, removed the status check while creating BiDi session, the status seems important if we create BiDi only session, which is not in scope for us currently.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Member

@diemol diemol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but seems some commented code was left in the changeset :)

java/src/org/openqa/selenium/manager/SeleniumManager.java Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Dec 19, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (e745a91) 58.04% compared to head (89ea242) 58.05%.
Report is 8 commits behind head on trunk.

❗ Current head 89ea242 differs from pull request most recent head ac8bceb. Consider uploading reports for the commit ac8bceb to get more accurate results

Files Patch % Lines
py/selenium/webdriver/firefox/firefox_binary.py 50.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #13333   +/-   ##
=======================================
  Coverage   58.04%   58.05%           
=======================================
  Files          88       88           
  Lines        5337     5338    +1     
  Branches      224      224           
=======================================
+ Hits         3098     3099    +1     
  Misses       2015     2015           
  Partials      224      224           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pujagani pujagani merged commit 7acc040 into SeleniumHQ:trunk Dec 20, 2023
34 of 41 checks passed
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

Successfully merging this pull request may close these issues.

[🐛 Bug]: BiDi Connection is established on driver.close / driver.quit
4 participants