I want to use following function in 2-3 pages so i want to call that function but getting exception "static method is required..."
Here in Code CommonFunction is a class which extends Page Class
def "User clicks on My Account Link"(){
CommonFunction."User clicks on My Account Link"()
}
I tried following approach also but still getting exception "geb.error.PageInstanceNotInitializedException: Instance of page class com.casestudy.util.CommonFunctions has not been initialized. Please pass it to Browser.to(), Browser.via(), Browser.page() or Browser.at() before using it."
CommonFunctions commonfunction= new CommonFunctions()
def "User clicks on My Account Link"(){
commonfunction."User clicks on My Account Link"()
}
here is the code for the function User clicks on My Account link()
def "User clicks on My Account Link"(){
def actions = new Actions(driver)
myaccountMenu.displayed
WebElement myaccountMenu = myaccountMenu.firstElement()
actions.click(myaccountMenu).build().perform()
}