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
chromedp.Cancel and cancel from chromedp.NewContext do a different thing #866
Comments
I wrote this function that fixes the following:
I am not sure if it is usable by default as cancelation func from |
Have you read the docs below? Lines 84 to 98 in 4b483eb
Lines 181 to 195 in 4b483eb
Basically, I will just call the cancel func to cancel the context. And if I need the browser to be closed gracefully, I will call
Do you have a concrete use case? Does #674 help in this case? |
This does not tell anything about the subtle differences of cancel vs. Cancel that I listed above
Yep I use xvfb-chromium, adapted from https://github.com/atlassian/docker-chromium-xvfb/blob/master/images/base/xvfb-chromium (changed somewhat), that kills the xvfb afterwards. |
It has been mentioned here. I don't know how to improve the doc. Do you want to send a PR to improve it? WRT xvfb, can you try whether |
OK, so, this behavior is expected. So I will send PRs to improve the docs. Should calling |
I think calling |
https://golang.org/pkg/context/#CancelFunc In normal context, it works.
So it is a bit unexpected here. But OK, as you wish :) |
Please note that |
I think the issue has been addressed. Closing. |
chromedp.Cancel and chromedp.NewContext cancel function behave very differently, which is not at first obvious from the documentation.
The documentation mentions that
chromedp.Cancel
is "checking for errors", but that is not all the difference.This all applies only when the context is the first tab. I am not sure what are the differences if the context is for a second tab.
I am not sure if this is desired behavior or not.
It is not documented, but I am not sure if it's better to change the documentation or change the behavior so the two functions are consistent and only differ in error checking (as that can introduce some subtle issues in existing code).
The text was updated successfully, but these errors were encountered: