title: Setting page url dynamically in Geb
body: <p>In this scenario, I want to navigate from the main page to the sub page and perform some actions. The url of the sub page is dynamically generated, but the page content is the same. This is what I have tried so far: </p>
  
  <p>In the main class:</p>
  
  <pre><code>to MainPage
      SubPageButton.click()
      to SubPage
      SelectAddressButton.click()
  </code></pre>
  
  <p>In the Page class:</p>
  
  <pre><code>public class SubPage extends Page {
      static url = getCurrentUrl()
      static content = {
          SelectAddressButton { $("button", 0) }
      }
  }
  </code></pre>
  
  <p>I have alternatively tried (without any success)</p>
  
  <ol>
  <li>Defining the static content for the sub page ( SelectAddressButton )
  in the Page object for the main page.   </li>
  <li>Defining the sub page without the url</li>
  </ol>
  
  <p>Thanks a lot in advance!</p>