{"id":23511566,"url":"https://github.com/tahahachana/webdriverbidi","last_synced_at":"2025-10-31T12:30:23.469Z","repository":{"id":269521085,"uuid":"907673728","full_name":"TahaHachana/webdriverbidi","owner":"TahaHachana","description":"WebDriver BiDi client implementation in Rust.","archived":false,"fork":false,"pushed_at":"2025-02-15T18:01:49.000Z","size":1296,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T19:18:45.147Z","etag":null,"topics":["browser-automation","rust","tokio","webdriver","webdriver-bidi","websocket"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/webdriverbidi","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TahaHachana.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-24T05:58:45.000Z","updated_at":"2025-02-15T18:01:52.000Z","dependencies_parsed_at":"2024-12-24T07:24:32.920Z","dependency_job_id":"946043e4-b022-49ba-aeeb-622329a89542","html_url":"https://github.com/TahaHachana/webdriverbidi","commit_stats":null,"previous_names":["tahahachana/webdriverbidi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TahaHachana%2Fwebdriverbidi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TahaHachana%2Fwebdriverbidi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TahaHachana%2Fwebdriverbidi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TahaHachana%2Fwebdriverbidi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TahaHachana","download_url":"https://codeload.github.com/TahaHachana/webdriverbidi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239194359,"owners_count":19598020,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser-automation","rust","tokio","webdriver","webdriver-bidi","websocket"],"created_at":"2024-12-25T12:15:22.745Z","updated_at":"2025-10-31T12:30:23.428Z","avatar_url":"https://github.com/TahaHachana.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webdriverbidi\n\n## Overview\n\nThe webdriverbidi library provides an interface for interacting with web browsers through the WebDriver BiDi (Bidirectional) protocol. This library allows you to create and manage WebDriver sessions, send commands, and handle responses asynchronously through WebSockets.\n\n## Features\n\n- Create and manage WebDriver BiDi sessions\n- Send commands\n- Handle events asynchronously\n\n## Getting Started\n\n### Prerequisites\n\n- Rust and Cargo installed\n- A WebDriver server that supports the BiDi protocol\n\n### Installation\n\nAdd the following to your `Cargo.toml` (the example below will also require tokio with full features):\n\n```toml\n[dependencies]\nwebdriverbidi = \"0.1.16\"\n```\n\n### Usage\n\nStart a WebDriver BiDi compliant server\n\n```bash\n$ geckodriver --host=localhost --port=4444\n# chromedriver --host=localhost --port=4444\n# ./msedgedriver --host=localhost --port=4444\n```\n\nCreate a new Rust project and add the following code to `src/main.rs`:\n\n```rust\nuse anyhow::Result;\nuse tokio::time;\n\n// --------------------------------------------------\n\nuse webdriverbidi::remote::browsing_context::{\n    GetTreeParameters, NavigateParameters, ReadinessState,\n};\nuse webdriverbidi::session::WebDriverBiDiSession;\nuse webdriverbidi::webdriver::capabilities::CapabilitiesRequest;\n\n// --------------------------------------------------\n\nconst HOST: \u0026str = \"localhost\";\nconst PORT: u16 = 4444;\n\n// --------------------------------------------------\n\nasync fn sleep_for_secs(secs: u64) {\n    time::sleep(time::Duration::from_secs(secs)).await\n}\n\n/// Initializes a new WebDriver BiDi session.\npub async fn init_session() -\u003e Result\u003cWebDriverBiDiSession\u003e {\n    let capabilities = CapabilitiesRequest::default();\n    let mut session = WebDriverBiDiSession::new(HOST.into(), PORT, capabilities);\n    session.start().await?;\n    Ok(session)\n}\n\n/// Retrieves the browsing context at the specified index.\npub async fn get_context(session: \u0026mut WebDriverBiDiSession, idx: usize) -\u003e Result\u003cString\u003e {\n    let get_tree_params = GetTreeParameters::new(None, None);\n    let get_tree_rslt = session.browsing_context_get_tree(get_tree_params).await?;\n    if let Some(context_entry) = get_tree_rslt.contexts.get(idx) {\n        Ok(context_entry.context.clone())\n    } else {\n        anyhow::bail!(\"No browsing context found at index {idx}\");\n    }\n}\n\n/// Navigates to the specified URL and waits for the document to completely load.\npub async fn navigate(session: \u0026mut WebDriverBiDiSession, ctx: String, url: String) -\u003e Result\u003c()\u003e {\n    let navigate_params = NavigateParameters::new(ctx, url, Some(ReadinessState::Complete));\n    session.browsing_context_navigate(navigate_params).await?;\n    Ok(())\n}\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c()\u003e {\n    let mut session = init_session().await?;\n    let ctx = get_context(\u0026mut session, 0).await?;\n\n    let url = String::from(\"https://www.rust-lang.org/\");\n    navigate(\u0026mut session, ctx, url).await?;\n\n    sleep_for_secs(1).await;\n    session.close().await?;\n    Ok(())\n}\n```\n\n## Module Coverage\n\n### session\n#### Types\n- [x] session.CapabilitiesRequest\n- [x] session.CapabilityRequest\n- [x] session.ProxyConfiguration\n- [x] session.UserPromptHandler\n- [x] session.UserPromptHandlerType\n- [x] session.Subscription\n- [x] session.SubscriptionRequest\n- [x] session.UnsubscribeByIDRequest\n- [x] session.UnsubscribeByAttributesRequest\n\n#### Commands\n- [x] session.status\n- [x] session.new\n- [x] session.end\n- [x] session.subscribe\n- [x] session.unsubscribe\n\n### browser\n#### Types\n- [x] browser.ClientWindow\n- [x] browser.ClientWindowInfo\n- [x] browser.UserContext\n- [x] browser.UserContextInfo\n\n#### Commands\n- [x] browser.close\n- [x] browser.createUserContext\n- [x] browser.getClientWindows\n- [x] browser.getUserContexts\n- [x] browser.removeUserContext\n- [x] browser.setClientWindowState\n\n### browsingContext\n#### Types\n- [x] browsingContext.BrowsingContext\n- [x] browsingContext.Info\n- [x] browsingContext.Locator\n- [x] browsingContext.Navigation\n- [x] browsingContext.NavigationInfo\n- [x] browsingContext.ReadinessState\n- [x] browsingContext.UserPromptType\n\n#### Commands\n- [x] browsingContext.activate\n- [x] browsingContext.captureScreenshot\n- [x] browsingContext.close\n- [x] browsingContext.create\n- [x] browsingContext.getTree\n- [x] browsingContext.handleUserPrompt\n- [x] browsingContext.locateNodes\n- [x] browsingContext.navigate\n- [x] browsingContext.print\n- [x] browsingContext.reload\n- [x] browsingContext.setViewport\n- [x] browsingContext.traverseHistory\n\n#### Events\n- [x] browsingContext.contextCreated\n- [x] browsingContext.contextDestroyed\n- [x] browsingContext.navigationStarted\n- [x] browsingContext.fragmentNavigated\n- [x] browsingContext.historyUpdated\n- [x] browsingContext.domContentLoaded\n- [x] browsingContext.load\n- [x] browsingContext.downloadWillBegin\n- [x] browsingContext.navigationAborted\n- [x] browsingContext.navigationCommitted\n- [x] browsingContext.navigationFailed\n- [x] browsingContext.userPromptClosed\n- [x] browsingContext.userPromptOpened\n\n### network\n#### Types\n- [x] network.AuthChallenge\n- [x] network.AuthCredentials\n- [x] network.BaseParameters\n- [x] network.BytesValue\n- [x] network.Cookie\n- [x] network.CookieHeader\n- [x] network.FetchTimingInfo\n- [x] network.Header\n- [x] network.Initiator\n- [x] network.Intercept\n- [x] network.Request\n- [x] network.RequestData\n- [x] network.ResponseContent\n- [x] network.ResponseData\n- [x] network.SetCookieHeader\n- [x] network.UrlPattern\n\n#### Commands\n- [x] network.addIntercept\n- [x] network.continueRequest\n- [x] network.continueResponse\n- [x] network.continueWithAuth\n- [x] network.failRequest\n- [x] network.provideResponse\n- [x] network.removeIntercept\n- [x] network.setCacheBehavior\n\n#### Events\n- [x] network.authRequired\n- [x] network.beforeRequestSent\n- [x] network.fetchError\n- [x] network.responseCompleted\n- [x] network.responseStarted\n\n### script\n#### Types\n- [x] script.Channel\n- [x] script.ChannelValue\n- [x] script.EvaluateResult\n- [x] script.ExceptionDetails\n- [x] script.Handle\n- [x] script.InternalId\n- [x] script.LocalValue\n- [x] script.PreloadScript\n- [x] script.Realm\n- [x] script.PrimitiveProtocolValue\n- [x] script.RealmInfo\n- [x] script.RealmType\n- [x] script.RemoteReference\n- [x] script.RemoteValue\n- [x] script.ResultOwnership\n- [x] script.SerializationOptions\n- [x] script.SharedId\n- [x] script.StackFrame\n- [x] script.StackTrace\n- [x] script.Source\n- [x] script.Target\n\n#### Commands\n- [x] script.addPreloadScript\n- [x] script.disown\n- [x] script.callFunction\n- [x] script.evaluate\n- [x] script.getRealms\n- [x] script.removePreloadScript\n\n#### Events\n- [x] script.message\n- [x] script.realmCreated\n- [x] script.realmDestroyed\n\n### storage\n#### Types\n- [x] storage.PartitionKey\n\n#### Commands\n- [x] storage.getCookies\n- [x] storage.setCookie\n- [x] storage.deleteCookies\n\n### log\n#### Types\n- [x] log.LogEntry\n\n#### Events\n- [x] log.entryAdded\n\n### input\n#### Types\n- [x] input.ElementOrigin\n\n#### Commands\n- [x] input.performActions\n- [x] input.releaseActions\n- [x] input.setFiles\n\n### webExtension\n#### Types\n- [x] webExtension.Extension\n\n#### Commands\n- [x] webExtension.install\n- [x] webExtension.uninstall\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftahahachana%2Fwebdriverbidi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftahahachana%2Fwebdriverbidi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftahahachana%2Fwebdriverbidi/lists"}