[WebUI] Take Full Page Screenshot


This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/webui-take-fullpage-screenshot.html

The keyword is not able to capture the whole page.

Here is the code:

WebUI.openBrowser('')

WebUI.navigateToUrl('https://docs.katalon.com/katalon-studio/docs/webui-take-area-screenshot.html#takeareascreenshot')

WebUI.takeFullPageScreenshot()

And the output screenshot, you can see “Name: flowControl” is missing:

Hi @sonya.song,
Firstly, Thanks for using our new keywords.
Currently, We have problems with handling pages that have sticky(float) elements because the takeFullPageScreenshot keyword uses scroll and capture methods. We will enhance in the next release of Katalon.
You can try using the keyword with hidden elements to hide sticky elements while taking screenshot.

    WebUI.takeFullPageScreenshot([findTestObject('header')])

where ‘header’ is a TestObject that link to sticky element that you got from WebSpy.
Thanks.

Hey @sonya.song, you can try to fix the footer position executing a javascript command with something like this:

WebElement footer = driver.findElement(By.xpath('//*[@id="root"]/main/footer/div[2]'))
WebUI.executeJavaScript('arguments[0].setAttribute(\'style\', \'position: static !important;\')',Arrays.asList(footer))

WebUI.takeFullPageScreenshot(fileAbsolutPath) not working as expected. This is method is taking screenshot just like normal one. I don’t see it scrolling and taking the complete page screenshot.

Katalon Version used: 7.7.2

Please help resolve this issue.

NOTE: Here the scroller is present for the table instead of the page.However this table occupies the entire page after some initial headings.

This keyword causes an error when running a local HTML file in IE.

This error does not occur in Chrome and Edge.

The error is as follows.

=============== ROOT CAUSE =====================
Caused by: java.lang.NullPointerException

# For trouble shooting, please visit: https://docs.katalon.com/katalon- 

studio/docs/troubleshooting.html

05-21-2021 01:50:17 午後 takeFullPageScreenshot(pngFile.toString())

Elapsed time: 0.213s

Cannot take screenshot (Root cause: 
com.kms.katalon.core.exception.StepFailedException: Cannot take screenshot
at
com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword.takeScreenshot(TakeFullPageScreenshotKeyword.groovy:125)
at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword.execute(TakeFullPageScreenshotKeyword.groovy:82)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.takeFullPageScreenshot(WebUiBuiltInKeywords.groovy:3166)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$takeFullPageScreenshot$1.call(Unknown Source)
at horizon scroll.run(horizon scroll:47)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:398)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:389)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:368)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:255)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1621572597331.run(TempTestCase1621572597331.groovy:25)
Caused by: java.lang.NullPointerException
at com.assertthat.selenium_shutterbug.utils.web.Browser.(Browser.java:84)
at com.assertthat.selenium_shutterbug.core.Shutterbug.shootPage(Shutterbug.java:139)
at com.assertthat.selenium_shutterbug.core.Shutterbug.shootPage(Shutterbug.java:83)
at com.assertthat.selenium_shutterbug.core.Shutterbug.shootPage(Shutterbug.java:69)
at com.kms.katalon.core.webui.util.FileUtil.takeFullPageScreenshot(FileUtil.java:92)
at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword$_takeScreenshot_closure1.doCall(TakeFullPageScreenshotKeyword.groovy:126)
at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword$_takeScreenshot_closure1.call(TakeFullPageScreenshotKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword.takeScreenshot(TakeFullPageScreenshotKeyword.groovy:125)
at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword.execute(TakeFullPageScreenshotKeyword.groovy:82)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.takeFullPageScreenshot(WebUiBuiltInKeywords.groovy:3166)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$takeFullPageScreenshot$1.call(Unknown Source)
at Script1621483990731.run(Script1621483990731.groovy:47)
… 11 more
)

Hi @giang.tong, may I know is there any update on this topic? It seems that Katalon(8.2.5) is still not able to get the full page screenshot correctly. Or, is there any other workaround to get it?
Thanks.