简体   繁体   中英

How to install browser on Azure App Service deployment

I have a need to use puppeteer sharp on a Azure app service deployment. Puppeteer sharp needs browser to do headless browsing. Does Azure app service comes with Edge installed? If not, How can I install a browser (chrome) in Azure app service deployment?

You can't install Edge on App Service because it's a sandboxed environment. The simplest solution is to use a virtual machine because you have more control. You can also try to deploy your app in a container, install your dependencies and run it on App Service.

A good way of getting around the no browser limitation of the app services is to use a 'browser as a service' service, like Browserless.

I've used Browserless for several months now and I've been very pleased with the service. They offer both usage-based and dedicated plans, to suit your needs and connecting to the service is very easy, like this example.

var connectOptions = new ConnectOptions() { BrowserWSEndpoint = "wss://chrome.browserless.io?token=YOURTOKENHERE" };
browser = await Puppeteer.ConnectAsync(connectOptions);

Once you've got your browser context, you can code your automated functionality as your normally would.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM