Unable to take screenshot of a testobject. Please help


#1

Hello,

I’m trying to take a screenshot of a specific test object but I can’t get it to work. I’m able to take screenshots of the entire page but not of the test object.

Here’s my code:
baseline = true
baselineDir = System.getProperty(‘user.dir’) + “\baseline”
screenshotDir = RunConfiguration.getProjectDir() + “\Screenshots”

CustomKeywords.'kms.turing.katalon.plugins.visualtesting.ScreenCapture.takeScreenshot'('fullscreen.png', FailureHandling.OPTIONAL)

CustomKeywords.'kms.turing.katalon.plugins.visualtesting.ScreenCapture.takeCuttingScreenshot'('cutting_screen.png',100, 50, FailureHandling.OPTIONAL)

CustomKeywords.'kms.turing.katalon.plugins.visualtesting.ScreenCapture.takeEntirePageScreenshot'('fullpage_screen.png', FailureHandling.OPTIONAL)

CustomKeywords.'kms.turing.katalon.plugins.visualtesting.ScreenCapture.takeWebElementScreenshot'(findTestObject('Object Repository/Page_Rdgivarstdet/h1_grundinfo'), 'grundinfo.png', 10, FailureHandling.OPTIONAL)
WebUI.delay(2)

As I mentioned, the first 3 screenshots work without a problem. I even changed the Failure handling in the parameter to “Stop On Failure” and it did stop but it din’t give me any information as to why the instruction failed.

Any feedback is much appreciated. Thanks.