Hi! Not popup, just usual page, you know sometimes on the page you can have
button for closing page (ex: term of use page).
Anyway, today I have found solution: I did not know about parameter
'close:false'
assert browser.availableWindows.size() == 1
browser.withNewWindow({ openLink() }, wait: true,close:false) {
waitFor{title == "Some_Title"}
assert browser.availableWindows.size() == 2
closeButton.click()
assert browser.availableWindows.size() == 1
}
On Monday, April 1, 2019 at 10:53:07 PM UTC+3, [email protected] wrote:
>
> Hi Gordon,
>
> I am not sure I am understanding you correctly, but my interpretation is
> you have a popup window that you are trying to click the Close button in
> and that close button closes the window? According to this section
> <http://www.gebish.org/manual/current/#code-close-code-2> in The Book of
> Geb, you can pass *close: false *as an option to the closure. This will
> stop the window from closing upon completion of the code in the closure.
> However, when you click the close button in the window, you will then
> manually need to point the driver back to the main window if you have any
> part of the test that needs to continue.
>
> I could be wrong but that was my interpretation of your issue.
>
> On Sunday, March 31, 2019 at 3:22:27 PM UTC-5, Gordon Freeman wrote:
>>
>> 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?
>>
>
--
You received this message because you are subscribed to the Google Groups "Geb
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/geb-user/6497b8b3-f5fa-4d1b-bdf0-f8bc961e55d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.