Data File Loop with Screen Shot

I have a simple test case that runs through a data file of multiple URL links successfully.
I would like to take a screen shot of each webpage that the test case goes (loops) through.
My current steps are:

WebUI.openBrowser(’ ')
for (def rowLink = 1; rowLink <=28; rowLink ++)
WebUI.navigateToUrl (findTestData(‘DataFile’).getValue(1, rowLink))


If I add this…‘WebUI.takeFullPageScreenshot(‘D:/Katalon Studio Screen Shots/Test.png’)
to the code block, then it takes the last webpage loaded.
This seems relative easy, am I missing the ‘tree’ in the forest?! Or is it more complex and would need to do a ‘While Loop’ process? Like Rahul Rathore’s example in Katalon Docs:
While loop in Katalon Studio | Katalon Docs

Regards from a newby…


I think that’s because you’re overriding the previous image since the path points to a fix image D:/Katalon Studio Screen Shots/Test.png’)’ every time.


WebUI.takeFullPageScreenshot("D:/Katalon Studio Screen Shots/Test-" + rowLink + ".png")

Thanks very much ThanhTo.
That was the tree in the forest I was looking for!

1 Like