Geb not pointing to right page after after closing confirm dialogue in new window

98 views
Skip to first unread message

sai.c...@spartancamera.com

unread,
Mar 13, 2019, 2:39:18 PM3/13/19
to Geb User Mailing List
I am doing test automation with geb in groovy, curently dealing with scenario like: First, I am in parent window, from there I open new window and do some search there, Clicking on the search result generates a confirm dialogue and updates the value in parent page, Bypassing the dialog with withConfirm(). then I come to parent window but nothing executes after that. I think geb is getting confused between pages.
In parent Page
  open new window 
  search for something  
  click on the first search result
  clicking on it opens a confirm dialog 
  click okay and close the new window 
continue with parent window


My code looks like:

withNewWindow(close: false,wait:true,{$(button that opens new window).click()}) {
        waitFor{
            title == "title"
        }
        withConfirm(wait: true){$(cause to open confirm dialog).click()}
        }
$("input[name='button'][id='SAVE_FOOTER']").click()
}



Error:

Caught: org.openqa.selenium.NoSuchWindowException: Browsing context has been discarded
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'DESKTOP-NAFK3F3', ip: '10.1.10.195', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_201'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 65.0.2, javascriptEnabled: true, moz:accessibilityChecks: false, moz:geckodriverVersion: 0.24.0, moz:headless: false, moz:processID: 12824, moz:profile: C:\Users\Dell\AppData\Local..., moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, platformVersion: 10.0, rotatable: false, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 2c0c768c-785f-49d4-bdff-186566e722dd
org.openqa.selenium.NoSuchWindowException: Browsing context has been discarded
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'DESKTOP-NAFK3F3', ip: '10.1.10.195', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_201'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 65.0.2, javascriptEnabled: true, moz:accessibilityChecks: false, moz:geckodriverVersion: 0.24.0, moz:headless: false, moz:processID: 12824, moz:profile: C:\Users\Dell\AppData\Local..., moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, platformVersion: 10.0, rotatable: false, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 2c0c768c-785f-49d4-bdff-186566e722dd
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
    at geb.js.JavascriptInterface.execjs(JavascriptInterface.groovy:66)
    at geb.js.JavascriptInterface.exec(JavascriptInterface.groovy:56)
    at geb.js.DefaultAlertAndConfirmSupport.popLastDialogFunctionOnto(DefaultAlertAndConfirmSupport.groovy:114)
    at geb.js.DefaultAlertAndConfirmSupport.captureDialog(DefaultAlertAndConfirmSupport.groovy:168)
    at geb.js.DefaultAlertAndConfirmSupport.captureConfirm(DefaultAlertAndConfirmSupport.groovy:182)
    at geb.js.DefaultAlertAndConfirmSupport.withConfirm(DefaultAlertAndConfirmSupport.groovy:54)
    at geb.js.DefaultAlertAndConfirmSupport.withConfirm(DefaultAlertAndConfirmSupport.groovy)
    at geb.js.AlertAndConfirmSupport$withConfirm.call(Unknown Source)
    at geb.Page.withConfirm(Page.groovy:130)
    at geb.Browser.methodMissing(Browser.groovy:249)
    at geb.Browser.invokeMethod(Browser.groovy)
    at CRMPageExample$_run_closure1$_closure3.doCall(CRMPageExample.groovy:149)
    at CRMPageExample$_run_closure1$_closure3.doCall(CRMPageExample.groovy)
    at geb.Browser.withNewWindow(Browser.groovy:798)
    at CRMPageExample$_run_closure1.doCall(CRMPageExample.groovy:137)
    at CRMPageExample$_run_closure1.doCall(CRMPageExample.groovy)
    at geb.Browser.drive(Browser.groovy:128)
    at geb.Browser$drive$0.callStatic(Unknown Source)
    at geb.Browser.drive(Browser.groovy:98)
    at geb.Browser$drive.call(Unknown Source)
    at CRMPageExample.run(CRMPageExample.groovy:97)
1552494416789   Marionette  INFO    Stopped listening on port 52107
[Parent 12824, Gecko_IOThread] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 332
[Child 2628, Chrome_ChildThread] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 332
[Child 2628, Chrome_ChildThread] WARNING: pipe error: 109: file [Parent 12824, Gecko_IOThread] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 332
[Child 8068, Chrome_ChildThread] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 332
[Child 8068, Chrome_ChildThre
###!!! [Child][MessageChannel::SendAndWait] Error: Channel error: cannot send/recv



Methods I tried but seems useless

waitFor{
        withwindow{Parent window}){true}

    }
selenium testing groovy automated-tests geb

sai.c...@spartancamera.com

unread,
Apr 7, 2019, 1:23:58 PM4/7/19
to Geb User Mailing List
Can anyone help me with this? or can anyone update the status on git? https://github.com/geb/issues/issues/568

Marcin Erdmann

unread,
Apr 7, 2019, 3:01:46 PM4/7/19
to geb-...@googlegroups.com
As suggested in my reply to your Stack Overflow question, this looks like an issue in Geb with handling alerts - thanks for filing a ticket in the tracker for it. 

I suggested using the native (WebDriver API) way of handling alerts to work around the issue in this comment: https://stackoverflow.com/questions/55147545/geb-not-pointing-to-right-page-after-closing-confirm-dialog-in-new-window/55158497#comment97089979_55158497 and pointed you at a tutorial which explains that I mean by handling alerts using WebDriver API: https://stackoverflow.com/questions/55147545/geb-not-pointing-to-right-page-after-closing-confirm-dialog-in-new-window/55158497#comment97149900_55158497

To be honest with you, I'm not sure what kind of help are you expecting apart from what has been already provided.

Marcin

--
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 geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/84ba9c7e-f487-4475-afc4-754d85a3aae7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gordon Freeman

unread,
Apr 7, 2019, 4:18:56 PM4/7/19
to Geb User Mailing List
Then more I am working with GEB - then more I understand how poor it is, sometimes it easier to use clean Selenium or add Selenide to your dependency. Sorry for off-topic.

Marcin Erdmann

unread,
Apr 8, 2019, 6:28:53 AM4/8/19
to geb-...@googlegroups.com
On Sun, Apr 7, 2019 at 9:18 PM Gordon Freeman <sda.f...@gmail.com> wrote:
Then more I am working with GEB - then more I understand how poor it is, sometimes it easier to use clean Selenium or add Selenide to your dependency. Sorry for off-topic.

You are entitled to your own opinion. Thankfully there is a lot of people who would not agree with you.

All the best,
Marcin

Brian Kotek

unread,
Apr 8, 2019, 2:39:28 PM4/8/19
to Geb User Mailing List
Agreed.

Don't let one self-entitled person bring you down, Marcin. Everyone else appreciates your efforts on Geb. Thanks for all you do.

--
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 geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.

Gordon Freeman

unread,
Apr 8, 2019, 2:43:07 PM4/8/19
to geb-...@googlegroups.com
Yes, Marcin, you are right, but my opinion was built on current topics, I have never seen such a big amount of questions without answers. My opinion Geb - full of mistakes product and has no growth. Selenide for example much easier, better community and very fast fixing any issues.

Best regards,
SDA


--

Sai Chintha

unread,
Apr 8, 2019, 2:55:29 PM4/8/19
to geb-...@googlegroups.com
Marcin, Great work on building Geb. I really appreciate your quick responses as well.   
I tried using the native web driver. But It don't know. 
To be more precise, I am using the above described scenario(handling an alert in new window) on suite CRM to update records. When I use the native web driver it works exactly only once on each record, if I try to do it again on the same record it gives me the same error (https://github.com/geb/issues/issues/568). I wonder if geb or my browser try to save cache. I tried again after deleting cache but it didn't worked. It might be also an issue with suiteCRM. Any help would be appreciated.
Thank you, 

Message has been deleted

jeremy...@gmail.com

unread,
Apr 8, 2019, 2:57:49 PM4/8/19
to Geb User Mailing List
Full of mistakes?  The only times I have had problems with Geb is when I misunderstood something and didn't use it correctly.  And even then, Marcin is usually quick to respond and provide help when asked (provided he isn't on holiday).  Has no growth?  Geb has come a long way and has 8 releases since the beginning of 2017.

You might be entitled to your own opinion, but it's wrong especially when it can be proven false pretty easily based on the reasons you dislike it.

I agree with Brian.  Geb is fantastic and I appreciate everything Marcin and others have done for it.

On Monday, April 8, 2019 at 1:43:07 PM UTC-5, Gordon Freeman wrote:
Yes, Marcin, you are right, but my opinion was built on current topics, I have never seen such a big amount of questions without answers. My opinion Geb - full of mistakes product and has no growth. Selenide for example much easier, better community and very fast fixing any issues.

Best regards,
SDA


On Mon, Apr 8, 2019 at 1:28 PM Marcin Erdmann <marcin...@proxerd.pl> wrote:
On Sun, Apr 7, 2019 at 9:18 PM Gordon Freeman <sda.f...@gmail.com> wrote:
Then more I am working with GEB - then more I understand how poor it is, sometimes it easier to use clean Selenium or add Selenide to your dependency. Sorry for off-topic.

You are entitled to your own opinion. Thankfully there is a lot of people who would not agree with you.

All the best,
Marcin

--
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 geb-...@googlegroups.com.

Brian Kotek

unread,
Apr 8, 2019, 3:18:04 PM4/8/19
to Geb User Mailing List
Cool, go use Selenide. I'm sure they'll be thrilled to help a demanding, self-entitled user with vague, unconstructive complaints.

Gordon Freeman

unread,
Apr 8, 2019, 4:18:15 PM4/8/19
to Geb User Mailing List
Ok, how can I do the next things in GEB:
1. Switching between tabs (I have the same titles)
2. Switch to alert dialog in IE and accept it. I spent 2 hours (using withAlert and withConfirm) then decided to do that in selenium - browser.switchTo.alert.accept
3. Wait until element disappear
4. BTW in Selenide I can get clear stack trace when something failed and automatically will be created screenshot and HTML file, in GEB I can see some unreadable data.
5. Selenide works with JUnit 5 ! I hope not necessary to explain which features have JUnit5
6. How can I do cycles (for example: create few users) in GEB if page with list of users and creation user page - are various. Every time I have to do this: 
at UserListPage
at
CreationUserPage
etc
...
7. WaitFor - something very strange, sometimes it works, sometimes I need to create my custom waiter.
8. How to get collections? In Selenide I can use - $$ 

 
Guys, I like Groovy and working on UI automation with GEB, because customer wants, but even after few months using it - I still can not get used and very often use just selenium.

Roman Tretyak

unread,
Apr 8, 2019, 5:09:49 PM4/8/19
to Geb User Mailing List
Why are you so pissed off, sir? Selenide for sure is a great tool and they must have their own mail list. Why flaming here? Also, you can resend the same to your customer, I'm sure he knows that you are an experienced professional worth listening to.
Btw, most of the 'issues' above made me smile, sorry.

понедельник, 8 апреля 2019 г., 23:18:15 UTC+3 пользователь Gordon Freeman написал:

Marcin Erdmann

unread,
Apr 12, 2019, 5:47:04 AM4/12/19
to geb-...@googlegroups.com
Sai,

The fact that it fails with the same error when using native WebDriver alert handling suggests to me that this might be an underlying issue with the page you're testing or the driver you're using and not really an issue in Geb (even though I plan to look closer at the ticket you submitted in the near future anyway because I have spotted something suspicious in that part of the codebase).. Have you tried running the test using different drivers? If so, is the error the same across all of them?

Reply all
Reply to author
Forward
0 new messages