简体   繁体   中英

How to use `GoToAsync()` from PuppeteerSharp to support local path but not with https?

I am using PuppeteerSharp in C#.

I would like to use await page.GoToAsync(localPath); but faced below exception:

Protocol error (Page.navigate): Cannot navigate to invalid URL

How can I support browsing local path instead of HTTPS?

For local path, need to use file protocol like below:

await page.GoToAsync("file://" + Path.Combine(context.FunctionAppDirectory, "www", "index.html"));

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