HTML of a web page

Hello,

I would like to create an automatic test that allows me to validate the SEO of a website. To do this, I would need the entire HTML of the page to be tested. Does anyone know how to retrieve HTML with Katalon?

You can retrieve the whole HTML by grabbing its source code. Well it’s easy to do so:

import org.openqa.selenium.WebDriver

import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.openBrowser('')
WebDriver driver = DriverFactory.getWebDriver()
driver.getPageSource()
1 Like

Hello,

I have used your code. But, Can I view a HTML code on a new web page? Now, when I launch the test, I verify only if it’s Passed or Failed.

Thanks.

Cattura.PNG

1 Like

how about something like:

import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.openBrowser('')
WebDriver driver = DriverFactory.getWebDriver()
def myHTML = driver.getPageSource()println myHTML