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

Fix the problem that it closes all tabs when using webdriver.close() to close the current tab in Edge IE Mode. #9998

Merged
merged 2 commits into from
Nov 4, 2021

Conversation

yk9772
Copy link
Contributor

@yk9772 yk9772 commented Oct 29, 2021

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

Let it go the same way in Edge IE Mode as in IE when closing the current tab(window).

Motivation and Context

To solve the problem that it closes all active tabs(windows) when using webdriver.close() to close the current tab(window) in Edge IE Mode.

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.

Fix the problem that it closes all tabs when using webdriver.close() to close the current tab in Edge IE Mode.
@CLAassistant
Copy link

CLAassistant commented Oct 29, 2021

CLA assistant check
All committers have signed the CLA.

@jimevans
Copy link
Member

jimevans commented Nov 2, 2021

@guangyuexu What would be the implications of this change after merging your pending PR?

@bwalderman
Copy link
Contributor

I see the CloseWindowCommandHandler and the QuitCommandHandler both use Browser::Close, and the key difference is that QuitCommandHandler iterates through all managed Browsers instead of just one.

In IE Mode, this will correctly terminate all of the underlying IE processes, but for the Quit command we should still make sure the parent Edge process is cleaned up to. I'd recommend keeping the PostMessage(GetTopLevelWindowHandle(), WM_CLOSE, 0, 0); call. This should be the last step after all of the managed Browser objects have been closed.

@jimevans
Copy link
Member

jimevans commented Nov 4, 2021

@bwalderman Noted. I'll merge this one, and move the PostMessage call to a more appropriate place.

@jimevans jimevans merged commit 63371ba into SeleniumHQ:trunk Nov 4, 2021
@jimevans
Copy link
Member

jimevans commented Nov 4, 2021

@yk9772 Thank you for your contribution!

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 4, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

elgatov pushed a commit to elgatov/selenium that referenced this pull request Jun 27, 2022
Fix the problem that it closes all tabs when using webdriver.close() to close the current tab in Edge IE Mode.

Signed-off by: jimevans <james.h.evans.jr@gmail.com>
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.

4 participants