D

Website Snapshots

Dan_W

Well-known Member
Joined
Jul 11, 2018
Messages
1,935
Office Version
  1. 365
Platform
  1. Windows
Dan_W submitted a new Excel article:

Website Snapshots - A simple method of taking a PNG or full-page PDF snapshot of a webpage

It is possible to take website snapshots quickly and easily with any chromium-based browser (this includes Chrome (obviously), MS Edge, Brave, and Opera) as they all include headless browser functionality - this means that you are able to use VBA give your browser instructions to generate screenshots (in PNG) and full-page PDF captures. Google set out how to go about it from the command line here, but I...

Read more about this Excel article...
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Dear DAN_W,

Thanks for this wonderful piece of inspiration.

I have a case to ask where websites which require login to access a specific page are stuck on login (Means the screenshot is of the page asking to log in as if I have not logged before) page whereas my regular Chrome browser is already logged in.

Am I missing some understanding here?

Example: Am trying to take screenshot of below URL and am currently logged into the website.


but when above link is passed to module then the screenshot is of the login page.

I believe that the instance of the browser being used for screenshot is not carrying the same credential as the regular browser. Could you please suggest a way?

Best Regards
Ashish
 
Hi ashish128

That's an excellent question - my understanding is that when you start one of these browsers in Headless mode, they will be free of any existing user/session data - like cookies, which are what would be used by Asana to work out whether or not you should still be logged in. So although you may have just logged in manually in Chrome, the headless browser simply ignores all that information by default.

Ordinarily, what you would do is you would use Selenium or puppeteer to automate the process, and these solutions have methods where you can retrieve existing cookies, and then set them when accessing a site, so you don't have to work out how to put in your credentials again! I'm not certain whether the same functionality is available here at the command line with the headless browser. I'll need to look into that a little bit.

That said, would you / have you considered using VBA + Selenium + Chrome?
 
Hi ashish128

That's an excellent question - my understanding is that when you start one of these browsers in Headless mode, they will be free of any existing user/session data - like cookies, which are what would be used by Asana to work out whether or not you should still be logged in. So although you may have just logged in manually in Chrome, the headless browser simply ignores all that information by default.

Ordinarily, what you would do is you would use Selenium or puppeteer to automate the process, and these solutions have methods where you can retrieve existing cookies, and then set them when accessing a site, so you don't have to work out how to put in your credentials again! I'm not certain whether the same functionality is available here at the command line with the headless browser. I'll need to look into that a little bit.

That said, would you / have you considered using VBA + Selenium + Chrome?
I came across your article and then only explored it. I love VBA but have not heard about Selenium before. I will try to research on VBA + Selenium + Chrome and will update you when there is one from my side.
Thanks for the code and guidance.
Best Regards.
 
Hello. any solution to key in user id / password in headless mode or read from other session cookies. I don't have Selenium. so looking for solution to ready user credentials from cookies from other manual session. Thanks in advance.
 

Forum statistics

Threads
1,223,604
Messages
6,173,315
Members
452,510
Latest member
RCan29

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top