cancel
Showing results for 
Search instead for 
Did you mean: 

How to capture entire website snapshot till bottom in Blueprism ???

Anujq
Level 3


Hi Guys,

is there any way in blueprism to take entire webpage screenshot till bottom once.

I did some google and found multiple method taking screenshot but that only takes current active screen snapshot but i want entire web page snapshot.

Thanks

------------------------------
Anuj q
q
a
UTC
------------------------------
4 REPLIES 4

david.l.morris
Level 15
Does it need to be a screenshot or would saving the HTML of the page to a file be sufficient? You can do Get HTML and save that, and if someone opens that file it will look similar to the original webpage and should at least have the same information on it, if not some of the formatting.

Am I correct in assuming the active screen snapshot isn't good enough because the webpage is taller than the screen and you want a snapshot of everything on the page?

------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

Hi,

The requirement is to taking screenshot not saving the same with HTML format.

As with Print screen command entire desktop view captures like bottom window bar and browser navigation menus and tabs,

Can we get only website response as image in BP.

Thanks

------------------------------
Anuj q
q
a
UTC
------------------------------

Try using Application Modeller to spy (Win32) the webpage (hover your mouse over the line between the IE bookmark bar (or whatever is just above the webpage) and the top of the webpage. At runtime (during the running of the process), you can retrieve the IE window  and its elements' attributes. Try Get Screen Bounds with a Read stage or any other options you see. This may take a bit of trial and error. I didn't actually use Get Screen Bounds as it returned really weird values for me but it seems like that should work for a couple of the values.

Anyway, what worked for me was to use a Read stage and read the attributes of that element for "Width", "Height", and then I used first 2 numbers in the Screen Bounds values which represent left and top. If you use a Read stage to get the attribute "Screen Bounds", it will return a value like RECT:399,165,1100,1511. The first number is left and the second number is top. That gets you the four inputs you need for the code below. You'll want to build some logic to get those numbers reliably and do some various testing of course. I just tested this really quick so no guarantees. 😃

Create number inputs to the code stage and provide numbers like I showed above:
  • width
  • height
  • left
  • top
The below code snippet is C#. Here are my External References:
  • System.dll
  • System.Data.dll
  • System.Xml.dll
  • System.Drawing.dll
  • System.Windows.Forms.dll
And here are my namespace imports:
  • System
  • System.Drawing
  • System.Data
  • System.Drawing.Imaging
  • System.Windows.Forms
I don't know that Forms is being used but I'm lazy and it's listed. 😃
var bmpScreenshot = new Bitmap(width,
                               height,
                               PixelFormat.Format32bppArgb);

var gfxScreenshot = Graphics.FromImage(bmpScreenshot);

gfxScreenshot.CopyFromScreen(left,
                            top,
                            0,
                            0,
                            bmpScreenshot.Size,
                            CopyPixelOperation.SourceCopy);

var filename = "C:\\Temp\\TestIEWebpage.png";

bmpScreenshot.Save(filename, ImageFormat.Png);


------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

Just tested the solution @Dave Morris posted. While quick and efficient, it's still limited to the screen bounds for what it'll actually fill in. (I set it to a height of 4096 for testing.)

​It sounds like you're wanting something that can capture beyond the bounds (cue Zone of the Enders music); I've found a couple libraries out there, but they seem to want a pre-defined URL so they can open it in a browserless manner. (IE: http://4rapiddev.com/csharp/c-save-web-page-url-to-image/#prettyPhoto ) If you don't need to login to whichever page it is, something like this might work.

Alternatively, you can leverage a virtual printer driver and send Ctrl+P to the browser. This one seems to be free and has no watermark: https://download.cnet.com/PDFill-Free-PDF-Editor-Basic/3000-18497_4-77622696.html?part=dl-&subj=dl&tag=button  (Disregard PDF in the title - it'll still save images instead.)

Edit: Or if they'll accept a .XPS file, that print functionality is already available natively.

------------------------------
Ami Barrett
Lead RPA Software Developer
Solai & Cameron
America/Chicago
------------------------------