Open 4r7if3x opened 11 months ago
You need to call Tab::enable_fetch
with the second argument as Some(true)
in order for Chrome to dispatch the "auth required" event. Make sure that whatever URL you visit that triggers the authorization prompt is covered by your request pattern (first arg to enable_fetch
).
This will work. However, the sequence of method calls is important. Calling navigate_to before authenticate will result in an error.
tab
.enable_fetch(None, Some(true))?
.authenticate(username, password)?
.navigate_to(url)?
.wait_until_navigated()?;
Since Chromium-based executables do not support hard-coded credentials within the URL passed to the
--proxy-server
flag, I attempted to pass the authentication when opening the website, using the same approach that worked during the manual testing, but I get the following timeout error:The event waited for never came
.I've also noticed that sometimes I'd get the
net::ERR_TUNNEL_CONNECTION_FAILED
error on both programmatic approach and manual testing, and it's often persistence.Do you know a workaround for this issue?