Skip to content

Commit

Permalink
Micro-optimization of the window closing inside the shared session st…
Browse files Browse the repository at this point in the history
…rategy
  • Loading branch information
aik099 committed Apr 10, 2024
1 parent 126c515 commit 21a79f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions library/aik099/PHPUnit/Session/SharedSessionStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected function stopAndForgetSession()
*/
private function _switchToMainWindow()
{
$this->_session->switchToWindow();
$this->_session->switchToWindow(); // Switch to the window before attempting to execute any window-based calls.
$actual_initial_window_name = $this->_session->getWindowName(); // Account for initial window rename.

foreach ( $this->_session->getWindowNames() as $name ) {
Expand All @@ -108,8 +108,9 @@ private function _switchToMainWindow()

$this->_session->switchToWindow($name);
$this->_session->executeScript('window.close();');
$this->_session->switchToWindow();
}

$this->_session->switchToWindow();
}

/**
Expand Down

0 comments on commit 21a79f7

Please sign in to comment.