Update playwright/README.md
This commit is contained in:
@@ -16,8 +16,9 @@ def Page():
|
|||||||
from playwright.sync_api import sync_playwright as P
|
from playwright.sync_api import sync_playwright as P
|
||||||
(context := P().start().firefox.launch().new_context()).set_default_timeout(0)
|
(context := P().start().firefox.launch().new_context()).set_default_timeout(0)
|
||||||
for attr in dir(page := context.new_page()):
|
for attr in dir(page := context.new_page()):
|
||||||
if attr[0] != '_' and callable(method := getattr(page, attr)): setattr(page, attr, sync(method))
|
if attr[0] != '_' and callable(f := getattr(page, attr)): setattr(page, attr, sync(f))
|
||||||
page._repr_png_ = page.screenshot; return page
|
page._repr_png_ = page.screenshot; return page
|
||||||
(page := Page()).goto('https://example.org')
|
page = Page()
|
||||||
print(page.title()) # Example Domain
|
page.goto('https://google.com')
|
||||||
|
page
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user