Hi! I am a new user of GEB framework and already got used to work with 'withNewWindow' method.
Scenario:
1. I am on the page 'A' pressing some link and automatically will be opened new Tab 'B' and I will be on tha tab 'B'
2. I am checking some elements on tab 'B' and also have to check 'Close' button on the page 'B'.
We have such functionality in our system, after pressing 'Close' button - automatically will be closed tab 'B' and user will be on the tab 'A'
S, I have tried to use this code
browser.withNewWindow({ $("someElement").click() }, wait: true) { //open new tab 'B'
assert title == Some_Title
//here checks for other elements on the page//
closeButton.click // here I will get exception, because tab 'B' will be closed, but closure is still in progress
}
But as I mentioned in code - it will produce exception, because closure is still in progress but tab is already closed after pressing 'Close' button on the page.
How can I manage this? How do people work with such cases?
Of course, I can open new tab 'B' without Geb and this 'withNewWindow' method, take unique tab ID and after pressing 'Close' button - write assert that browser has not such tab ID. But I wanna use GEB.
Is it possible?