class Playwright::Playwright

“‘
run(playwright)
with sync_playwright() as playwright:
browser.close()
# other actions…
page.goto(“example.com”)
page = browser.new_page()
browser = chromium.launch()
chromium = playwright.chromium # or “firefox” or “webkit”.
def run(playwright: Playwright):
from playwright.sync_api import sync_playwright, Playwright
“`python sync
to drive automation:
Playwright module provides a method to launch a browser instance. The following is a typical example of using Playwright

def android

@nodoc
def android
  wrap_impl(@impl.android)
end

def chromium # property

property
This object can be used to launch or connect to Chromium, returning instances of `Browser`.
def chromium # property
  wrap_impl(@impl.chromium)
end

def devices # property

property
```
run(playwright)
with sync_playwright() as playwright:

browser.close()
# other actions...
page.goto("http://example.com")
page = context.new_page()
context = browser.new_context(**iphone)
browser = webkit.launch()
iphone = playwright.devices["iPhone 6"]
webkit = playwright.webkit
def run(playwright: Playwright):

from playwright.sync_api import sync_playwright, Playwright
```python sync

Returns a dictionary of devices to be used with [`method: Browser.newContext`] or [`method: Browser.newPage`].
def devices # property
  wrap_impl(@impl.devices)
end

def electron

@nodoc
def electron
  wrap_impl(@impl.electron)
end

def event_emitter_proxy

def event_emitter_proxy
_emitter_proxy ||= EventEmitterProxy.new(self, @impl)

def firefox # property

property
This object can be used to launch or connect to Firefox, returning instances of `Browser`.
def firefox # property
  wrap_impl(@impl.firefox)
end

def off(event, callback)

@nodoc
-- inherited from EventEmitter --
def off(event, callback)
  event_emitter_proxy.off(event, callback)
end

def on(event, callback)

@nodoc
-- inherited from EventEmitter --
def on(event, callback)
  event_emitter_proxy.on(event, callback)
end

def once(event, callback)

@nodoc
-- inherited from EventEmitter --
def once(event, callback)
  event_emitter_proxy.once(event, callback)
end

def request # property

property
Exposes API that can be used for the Web API testing.
def request # property
  raise NotImplementedError.new('request is not implemented yet.')
end

def selectors # property

property
[extensibility](../extensibility.md) for more information.
Selectors can be used to install custom selector engines. See
def selectors # property
  wrap_impl(@impl.selectors)
end

def stop

```
playwright.stop()

browser.close()
page.screenshot(path="example.png")
page.goto("https://playwright.dev/")
page = browser.new_page()
browser = playwright.chromium.launch()

playwright = sync_playwright().start()

from playwright.sync_api import sync_playwright
```py

Terminates this instance of Playwright in case it was created bypassing the Python context manager. This is useful in REPL applications.
def stop
  raise NotImplementedError.new('stop is not implemented yet.')
end

def webkit # property

property
This object can be used to launch or connect to WebKit, returning instances of `Browser`.
def webkit # property
  wrap_impl(@impl.webkit)
end