1

I have below .feature file which is use to capture the webpage

* def bytes = screenshot(false)
* def writeToPath = karate.write(bytes, path)

This code can work normally, it can capture and save the picture to the path. But the picture captured is a normal size same as the browser.

I want to capture the whole scrollable page area including vertically (body of the page) and horizontally (of an table element in the page) as picture below

Example of the webpage

The table's locator don't have name or any class, i use only its Relative XPath to locate it.

And I expected to capture it like this (or some other way that contains all information in the page vertically and horizontally)

Expected result

I have found this one https://karatelabs.github.io/karate/karate-core/#chrome-java-api but I don't have idea how to use it with my karate code, guiding me will be very appreciated.

Or if there any better ways that is possible and compatible with any Browser You can recommend me please

Aommie
  • 21
  • 1

1 Answers1

0

Can you try this:

* def bytes = driver.screenshotFull()
* def file = karate.write(bytes, 'myfile.png')

I think that should work. Do confirm !

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • Thanks for your response but It's not working. The screenshot is filled in with white space like this. https://i.imgur.com/X3y4rrY.png Or I miss some configuration? – Aommie Jun 09 '22 at 07:52
  • @TanawitPrasertsak sorry I can't help more on this :| perhaps you can contribute code to karate (or find someone who can) – Peter Thomas Jun 09 '22 at 10:07