I'm testing a payment process flow using codeception 2.2.9 with webdriver/selenium .
This is the interaction overview:
- user makes his order on our site
- after selecting payment provider, new window is opened with payment providers website in it (this is controlled by payment provider)
- user fills out his payment details on site of payment provider
- the last button click on payment providers website causes the window to be closed (this is where the problem is)
- we get confirmation form payment provider on the background
- user is being taken back to our site
Everything works fine, except when the window gets automatically closed as the last step of the flow by payment provider. I get a warning inside selenium server:
WARN - Exception: Window not found. The browser window may have been closed.
and an error inside codeception output:
[Facebook\WebDriver\Exception\NoSuchWindowException] Window not found. The browser window may have been closed.
After payment providers window gets automatically opened I'm switching to it like this:
$I->switchToNextTab();
The problem is caused by clicking a 'confirm' button on payment providers site which causes the window to get closed automatically like this:
$I->click('.form-submitter'); // now the window is gone
Is there anything I can do to prevent this error? Is there a way to expect the window to get closed?
Thank you for your help!