Geb Module Inside Frames

257 views
Skip to first unread message

Balaji KM

unread,
Aug 4, 2016, 12:42:17 PM8/4/16
to Geb User Mailing List
Hi Guys,

Currently I am in the process of migrating from 0.9.3 to 0.13.1.

My web application got 2 frames.  I defined Modules for both the frames. 

Module Class
class AbcModule extends Module {
    static content = {
bodyFrame { $("frame",name:'body')}
pageTitle {
withFrame(bodyFrame) {
$(".pagetitle").text()
}
}
}


Page Class 

class BasePage extends Page {
    static at = { abc.pageTitle == "XYZ" }
     static content = {
abc { module AbcModule}
}
}

This code works fine in 0.9.3.  

In 0.13.1, this code no longer working.  

From 0.13.1 onwards, It works only If I specify withFrame(abc.bodyFrame) inside my Page class. I tried setting base for my module with frame name,
which didn't work.

I would like to call module elements in Page class, without calling withFrame everytime. Is this possible?

Any pointers will be much appreciated.

Thanks,
Bala

 




Marcin Erdmann

unread,
Aug 8, 2016, 4:10:14 PM8/8/16
to Geb User Mailing List
Hi Bala,

Can you please explain in detail what "no longer working" means in this case? What is the error your seeing? Are you seeing an exception with a stacktrace? I would expect the code you posted to work just fine.

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+unsubscribe@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/a2658feb-4e56-4035-af5e-d561c2096d08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Balaji KM

unread,
Aug 9, 2016, 8:55:41 AM8/9/16
to Geb User Mailing List
Hi Marcin,

Thanks for responding. To reproduce this issue, I created a small geb project. 


I used the following website to reproduce this error.


In the above project, At checking works fine with 0.9.3 version but it fails with 0.13.1.     
I got element not found exception.

Regards,
Bala
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.

Marcin Erdmann

unread,
Aug 9, 2016, 4:24:27 PM8/9/16
to Geb User Mailing List
Hi Bala,

This is not working anymore because modules now resolve their bases eagerly. To make this work again you will need to ensure that your module base resolves into an element within the frame by wrapping its definition in a withFrame block:

class BasePage extends Page {
    static at = { abc.pageTitle == "XYZ" }
     static content = {
        abc {
            withFrame('body') { 
                module AbcModule
            }
        }
    }
}

Note that I'm using a different signature of withFrame(), one that takes a frame name or id - this is to avoid a problem of element that backs the $() method being scoped inside the wrong frame. You will also have to do that inside of your module class:

class AbcModule extends Module {
    static content = {
        pageTitle {
            withFrame('body') {
                $(".pagetitle").text()
            }
        }
}

Hope this helps,
Marcin

To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+unsubscribe@googlegroups.com.

To post to this group, send email to geb-...@googlegroups.com.

Balaji KM

unread,
Aug 10, 2016, 4:22:20 AM8/10/16
to Geb User Mailing List
Awesome Marcin!. This works :)  Many thanks for your detailed explanation.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Geb User Mailing List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/geb-user/uxgcgWgmGYE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to geb-user+u...@googlegroups.com.

To post to this group, send email to geb-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages