Many thanks for your suggestions. I have been using to() extensively and didn't know that we could skip the definition of url property (especially for pages with dynamic urls).Now, when I have removed the url property in my page objects and the to( ) calls in spec, it fails to find the elements or methods defined in the page.
A typical page object in my project:
class MyPage extends Page {
static at = { title == "Version 1.0" }
static content = {
search (wait:true) {$("input", type: "text", name: "search")}
send (wait:true) { $("input", class: "button go", type: "submit") }
}
// this method would click any (text) hyperlink on the page
def clickMenu(String link){
def menuLink = $("a" , text : link)
menuLink.click()
}
}
Spec() {
// post login, say current page is MyPage
search = 'keyword' // unable to resolve 'search' as property of ...
send.click()
clickMenu('menu option 1') // missing method exception ....
}
As you can see I get errors for the same code which was working (with URL property set). Is it due to the wait strategy, please help.