Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Screenshotting a website that requires a login with Freezer c#

$
0
0

I'm trying to screenshot a website that requires a login using the .NET library freezer: https://github.com/haga-rak/Freezer/wiki

Using below code, I'm able to get a screenshot of any URL I enter

public void screenshotCreate(string url){var screenshotJob = ScreenshotJobBuilder.Create(url)            .SetBrowserSize(2560, 1440)            .SetCaptureZone(CaptureZone.FullPage)            .SetTrigger(new WindowLoadTrigger())            System.IO.File.WriteAllBytes(@"C:\Users\admin\documents\image.png", screenshotJob.Freeze());}

But if I enter a URL that has a webpage with login functionality, I'm just getting a screenshot of that login page.

For example:

If I wanted a screenshot of "My orders" page from amazon, I could set my URL to https://www.amazon.com/gp/css/order-history?ref_=nav_orders_first

Since my web browser is not logged in, it's simply displaying the sign-in page for amazon

In the documentation, there is code for adding cookies to the browser

var screenshotJob = ScreenshotJobBuilder.Create("https://yourwebsite.com")           .AddCookie(new Cookie("yourwebsite.com", "/", "CookieName", "1"));

but I'm unsure to interpret this code. Is it possible to load an existing cookie, say from my browser that has the login for Amazon stored?


Viewing all articles
Browse latest Browse all 3067

Trending Articles