showCheck.click();
page.waitForLoadState(LoadState.LOAD);
Page checkImagePage = page.context().pages().get(1);
ElementHandle checkImage = checkImagePage.querySelector("#img1");
The showCheck.click() call should open a new tab in the browser, and that’s exactly what happens. A new tab appears in the browser window showing exactly what I expect it to show. So far, so good. Now I want to interact with the new tab.
If I understand correctly (and apparently I don’t!) that means the page.context().pages().get(1) call should return a reference to a Page representing my new tab. Instead it throws an index out of bounds exception.
Any idea what I’m missing?