capture image of web page with scrollbar

Asked by sarab

I am trying to capture image of webpage with scrollbars. I am wondering if this is possible with Sikuli. I was able to do this using js library called html2canvas(https://github.com/niklasvh/html2canvas). it converts the page into canvas and then canvas to blob to save it as image in png or jpeg format. It has certain limitations like missing background color while generating image. I was able to cature single page webpage screenshot using Screen class in Sikuli API. For that, I had to launch the browser in full screen mode and made sure that there is no window on top of it which is not really ideal. Let me know if you guys have any clue.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
RaiMan Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

What is the question?

Revision history for this message
obiwan-92 (obiwan-92) said :
#2

Hello,

Read this : http://doc.sikuli.org/screen.html#capturing
You should find what you want on it.

One last thing : App("Your_Web_browser_title").window() return the region of your application.

Best regards.

Revision history for this message
sarab (sarab7-sep) said :
#3

It seems like I did not describe the question in detail. My bad. My objective is to capture image of complete webpage with scrollbars. Lets say web page consists of two pages and I will have to scroll down to second page to view second page. Now I want to capture image of complete web page (2 pages) instead of only visible area in window (on first page). App("title").window returns the region on the screen occupied by the window, if such window exists and None if otherwise. If first page is visible, it will only capture first page(not second page). This is where html2canvas was able to help me but it has its own issues. Does Sikuli have any support for this? in my testing , i just want to compare screenshot of webpages with benchmarks. Some web pages goes beyond visible area so I can not capture invisible part for comparison.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

No there currently is no solution for that as a Sikuli feature.

You might write a function, that uses wheel(down) until the window content stays the same after a wheel(down), which would signal the end of the page is reached. This could be sufficient to look for specific sub images on the page, but will not allow to get one big image of the webpage in one piece.

But I think this is a neat feature to have in the future ;-)

Revision history for this message
Dominic (gothicdominic) said :
#5

It seems to be a little troublesome from your description. I’m using a free online tool which is very convenient to screenshot full-length webpage. Just paste the URL of target webpage on its address box is okay. And the image could be saved in the format of PNG, JPG, GIF or BMP. If you want to have a try, you can access it here.
http://screenshot.net/webpage-screenshot

Can you help with this problem?

Provide an answer of your own, or ask sarab for more information if necessary.

To post a message you must log in.