title: How to call method from any other page without declaring method as static using GEB and Spock?
body: <p>I want to use following function in 2-3 pages so i want to call that function but getting exception "static method is required..."</p>
  
  <p>Here in Code CommonFunction is a class which extends Page Class</p>
  
  <pre><code>def  "User clicks on My Account Link"(){
  
      CommonFunction."User clicks on My Account Link"()   
  }
  </code></pre>
  
  <p>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."</p>
  
  <pre><code>CommonFunctions commonfunction= new CommonFunctions()
  def  "User clicks on My Account Link"(){
  
       commonfunction."User clicks on My Account Link"()  
  }
  </code></pre>
  
  <p>here is the code for the function User clicks on My Account link()</p>
  
  <pre><code>def  "User clicks on My Account Link"(){
      def actions = new Actions(driver)
      myaccountMenu.displayed
      WebElement myaccountMenu = myaccountMenu.firstElement()
      actions.click(myaccountMenu).build().perform()
  
  }
  </code></pre>