BrowserApi, ElementApi, AssertionApi and ScreenshotApi, shared by both engines.
3 min read
Note
Methods are listed as name(arguments), called on a BaseCase as sb.name(...).await?. The argument names, the selector syntax and the return types are explained in Reading the API reference.
seleniumbase_rs::{BrowserApi, ElementApi, AssertionApi, ScreenshotApi} are
four small async_trait traits (defined in src/api/traits.rs). Both engines
implement all four: BaseCase (WebDriver) and sb_cdp::Page (pure CDP). A helper
written over the traits runs on either engine. None of them names an engine
type; to keep an element handle, use BaseCase::find_element (a
thirtyfour::WebElement) or Page::locator(..). Every method returns
seleniumbase_rs::Result<T>. Selector strings are the same on both engines:
CSS by default, XPath for //..., link text for link=... (see the
Selectors guide).
Navigates the active window; a URL without a scheme gets https://; a file path or an unsupported scheme (ftp:, javascript:, mailto:) is refused with InvalidConfig (use file:// for a local file).
Page::goto(url).
quit(&mut self) -> Result<()>
Closes the browser session.
Closes this tab only. To close the browser call Browser::close.