- langs: python
Terminates this instance of Playwright in case it was created bypassing the Python context manager. This is useful in REPL applications.
>>> from playwright import sync_playwright
>>> playwright = sync_playwright().start()
>>> browser = playwright.chromium.launch()
>>> page = browser.newPage()
>>> page.goto("http://whatsmyuseragent.org/")
>>> page.screenshot(path="example.png")
>>> browser.close()
>>> playwright.stop()
- langs: python
path
<[path]>
Path to the JavaScript file. If path
is a relative path, then it is resolved relative to the current working directory. Optional.
- langs: python
script
<[string]>
Script to be evaluated in all pages in the browser context. Optional.
- langs: python
path
<[path]>
Path to the JavaScript file. If path
is a relative path, then it is resolved relative to the current working directory. Optional.
- langs: python
script
<[string]>
Script to be evaluated in all pages in the browser context. Optional.
- langs: python
Emulates position unavailable state.
- langs: python
latitude
<[float]>
Latitude between -90 and 90. required
- langs: python
longitude
<[float]>
Longitude between -180 and 180. required
- langs: python
accuracy
<[float]>
Non-negative accuracy value. Defaults to 0
. Optional.
- langs: python
media
<[null]|"screen"|"print">
Changes the CSS media type of the page. The only allowed values are 'screen'
, 'print'
and null
.
Passing null
disables CSS media emulation. Omitting media
or passing undefined
does not change the emulated value.
Optional.
- langs: python
colorScheme
<[null]|"light"|"dark"|"no-preference">
Emulates 'prefers-colors-scheme'
media feature, supported values are 'light'
, 'dark'
, 'no-preference'
. Passing
null
disables color scheme emulation. Omitting colorScheme
or passing undefined
does not change the emulated
value. Optional.