Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How about specify "--no-sandbox" at launch chrome? #4

Closed
tomityu opened this issue Nov 27, 2020 · 2 comments
Closed

How about specify "--no-sandbox" at launch chrome? #4

tomityu opened this issue Nov 27, 2020 · 2 comments

Comments

@tomityu
Copy link

tomityu commented Nov 27, 2020

Hi!

When I run the screenshot in docker, I get the following error:

[1128/031750.348471:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

This may be because you did not specify --no-sandbox as a launch argument for chrome.
How about adding arguments, or allowing users to choose to add arguments?

Thanks.

@vgalin
Copy link
Owner

vgalin commented Nov 28, 2020

Hi, thank you for opening an issue.

I added a custom_flags parameter for the Html2Image constructor, it allows you to pass any additional flag to the headless browser.

The following code should be working on Docker:

from html2image import Html2Image

hti = Html2Image(
    custom_flags=['--no-sandbox']
)
path = hti.screenshot(url="http://example.com", save_as='example.png')
print(path)

Could you confirm this?

@tomityu
Copy link
Author

tomityu commented Nov 28, 2020

Thank you for responding so quickly.
I was able to make sure it works properly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants