Struct playwright::api::playwright::Playwright[][src]

pub struct Playwright { /* fields omitted */ }
Expand description

Entry point

Implementations

impl Playwright[src]

pub async fn initialize() -> Result<Playwright, Error>[src]

Installs playwright driver to “$CACHE_DIR/.ms-playwright/playwright-rust/driver”

pub async fn with_driver(driver: Driver) -> Result<Playwright, Error>[src]

Constructs from installed playwright driver

pub fn prepare(&self) -> Result<()>[src]

Runs $ playwright install

pub fn install_chromium(&self) -> Result<()>[src]

Runs $ playwright install chromium

pub fn install_firefox(&self) -> Result<()>[src]

pub fn install_webkit(&self) -> Result<()>[src]

pub fn chromium(&self) -> BrowserType[src]

Launcher

pub fn firefox(&self) -> BrowserType[src]

Launcher

pub fn webkit(&self) -> BrowserType[src]

Launcher

pub fn driver(&mut self) -> &mut Driver[src]

pub fn selectors(&self) -> Selectors[src]

pub fn devices(&self) -> Vec<DeviceDescriptor>[src]

Returns a dictionary of devices to be used with [method: Browser.newContext] or [method: Browser.newPage].

const { webkit, devices } = require('playwright');
const iPhone = devices['iPhone 6'];

(async () => {
 const browser = await webkit.launch();
 const context = await browser.newContext({
   ...iPhone
 });
 const page = await context.newPage();
 await page.goto('http://example.com');
 // other actions...
 await browser.close();
})();

pub fn device(&self, name: &str) -> Option<DeviceDescriptor>[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.