-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for iframes and future timeout (#174)
* Detach from service workers and commandfuture timeout fix * Fixes logic of check_lifecycle * remove unwanted logging * Add doc and fix for service worker
- Loading branch information
Showing
6 changed files
with
135 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// This example is for checking the iframe workaround. | ||
// a problem with the iframe workaround is that it will always fail to load the page | ||
// and goto will cause a timeout. | ||
|
||
use std::time::Duration; | ||
|
||
use chromiumoxide::handler::HandlerConfig; | ||
use chromiumoxide_cdp::cdp::browser_protocol::target::CreateBrowserContextParams; | ||
use futures::StreamExt; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
tracing_subscriber::fmt::init(); | ||
|
||
let (browser, mut handler) = chromiumoxide::Browser::connect( | ||
"ws://127.0.0.1:9222/devtools/browser/191fdaef-494d-41b5-8b94-4abd04dff33c", | ||
HandlerConfig::default(), | ||
) | ||
.await | ||
.expect("failed to connect to browser"); | ||
|
||
let _ = tokio::task::spawn(async move { | ||
while let Some(event) = handler.next().await { | ||
tracing::debug!(event = ?event); | ||
} | ||
}); | ||
|
||
let page = browser | ||
.new_page("about:blank") | ||
.await | ||
.expect("failed to create page"); | ||
|
||
// tokio::time::sleep(Duration::from_secs(5)).await; | ||
|
||
// let _ = page | ||
// .goto("https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe") | ||
// .await | ||
// .expect("failed to navigate"); | ||
|
||
let _ = page | ||
.goto("https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe") | ||
.await | ||
.expect("failed to navigate"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters