pub struct BrowserSession { /* private fields */ }Expand description
A sandboxed headless browser controlled from outside.
The browser (Chromium via Playwright) runs inside an agentkernel sandbox. You call high-level methods; the SDK generates and executes scripts internally.
§Example
let client = agentkernel_sdk::AgentKernel::builder().build()?;
let mut browser = client.browser("my-browser", None).await?;
let page = browser.goto("https://example.com").await?;
println!("{} — {} links", page.title, page.links.len());
let png = browser.screenshot(None).await?;
browser.remove().await?;Implementations§
Source§impl BrowserSession
impl BrowserSession
Sourcepub async fn goto(&mut self, url: &str) -> Result<PageResult>
pub async fn goto(&mut self, url: &str) -> Result<PageResult>
Navigate to a URL and return page data (title, text, links).
Sourcepub async fn screenshot(&self, url: Option<&str>) -> Result<Vec<u8>>
pub async fn screenshot(&self, url: Option<&str>) -> Result<Vec<u8>>
Take a PNG screenshot. Returns the raw PNG bytes.
If url is None, re-uses the last URL from goto.
Auto Trait Implementations§
impl Freeze for BrowserSession
impl !RefUnwindSafe for BrowserSession
impl Send for BrowserSession
impl Sync for BrowserSession
impl Unpin for BrowserSession
impl !UnwindSafe for BrowserSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more