0

Just getting started with Katalon Recorder. After navigating and loading a page, is there a way to store the entire page text? I am trying to automate a function where I have to click into a list item, select all, copy and paste into excel.

Mate Mrše
  • 7,997
  • 10
  • 40
  • 77
DickyS
  • 115
  • 1
  • 10
  • What do you mean by "page text"? You can get the page source using `driver.getPageSource()`. Is that what you want? – Mate Mrše Jul 25 '18 at 06:36

1 Answers1

2

The comment from Mate Mrše is off to a good start. Here's some example code that fleshes out the details. The following code saves the page to an html file. From there you'll need additional processing to put it into another document format, such as Excel.

// add the following two imports for the webdriver
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import org.openqa.selenium.WebDriver as WebDriver

// open browser/navigate, etc
// WebUI.openBrowser('https://google.com')

WebUI.delay(5)

WebDriver driver = DriverFactory.getWebDriver()
def src = driver.getPageSource()
def file1 = new File('c:/1/the_saved_web_page.htm')
file1.write(src)
Adam Wise
  • 2,043
  • 20
  • 17