WebDriver driver = DriverFactory.getWebDriver() def html = driver.getPageSource() println(html)
But see this also: