javascriptwebdrivercodeceptjs

Invalid session id when closing current tab with CodeceptJs


I am getting an invalid session id error when trying to close my current tab using CodeceptJs and I.closeCurrentTab() and not sure how to fix this as most questions here seem to be about other frameworks, such as Selenium.


Solution

  • I got it working and it seems you actually need to switch back to the main tab and then close the other tabs instead

    When('The user switches back to the main tab', async () => {
      await I.switchTo();
      await I.closeOtherTabs();
    });
    

    More info here