-
Notifications
You must be signed in to change notification settings - Fork 20
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
Allow enable() methods to be called manually #144
Comments
@ashbythorpe Does this still repro for you? I can't reliably trigger the behavior you've described with the example code. Calling |
I think I have a decent fix in #202 (if you could try it I'd be grateful). But of course, after going through all of it I've started to wonder if we could just re-order the calls in your reprex so that your call to library(chromote)
session <- ChromoteSession$new()
authenticate <- function(x) {
id <- x$requestId
response <- list(
response = "ProvideCredentials",
username = "USERNAME",
password = "PASSWORD"
)
session$Fetch$continueWithAuth(
requestId = id,
authChallengeResponse = response
)
}
continue_request <- function(x) {
id <- x$requestId
session$Fetch$continueRequest(requestId = id)
}
# These two will trigger chromote's auto-events call to `Fetch$enable()`...
session$Fetch$requestPaused(
callback_ = continue_request
)
session$Fetch$authRequired(
callback_ = authenticate
)
# ...and maybe this would overwrite chromote's auto enable() call?
session$Fetch$enable(
patterns = list(
list(urlPattern = "*")
),
handleAuthRequests = TRUE
)
session$Page$navigate("https://google.com") |
I can no longer reproduce the warning, but from my testing, I don't think the
Yes, I tested this, and it works perfectly, of course. I imagine changing the behaviour is still desirable, but up to you. I've also tested with your PR, and it works as expected. |
I would like to call Fetch.enable using the
patterns
andhandleAuthRequests
arguments. However, since chromote calls Fetch.enable automatically when a callback is attached to a Fetch event, the method is called twice, which causes an error. I would like not to set theauto_events
field toFALSE
, since I can't change this value after it has been set.For example:
The
session$Page$navigate()
call causes the following warning:It would be useful if either:
auto_events
field to be modified.The text was updated successfully, but these errors were encountered: