Instantiate a playwright chromium (sync as opposed to async) browser
Project description
get-pwbrowser-sync
instantiate a playwright chromium sync (as opposed to async) browser
Installation
pip install get-pwbrowser-sync
# or
# pip install git+https://github.com/ffreemt/get-pwbrowser-sync.git
# python -m playwright install chromium
or via poetry
poetry add git+https://github.com/ffreemt/get-pwbrowser-sync.git &&
python -m playwright install chromium
Usage
from get_pwbrowser_sync import get_pwbrowser_sync
browser = get_pwbrowser_sync()
page = browser.new_page()
page.goto("http://www.baidu.com")
print(page.title())
# '百度一下,你就知道'
Use of .env
and os.environ
The browser can be run in a headful manner (to actually see what's going on):
from get_pwbrowser_sync import get_pwbrowser_sync
browser = get_pwbrowser_sync(headless=False)
Some related parameters HEADFUL
, DEBUG
and PROXY
can be set in shell environ or in .env with prefix PWBROWSER_
.
e.g., set PWBROWSER_HEADFUL=1
in Windows or export PWBROWSER_HEADFUL=1
in Linux and freinds)
or in .env
# .env
PWBROWSER_HEADFUL=1
For more details have a look at the source code.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for get-pwbrowser-sync-0.1.0a2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dde516321b907e860c5e57a5333d16390ac7bb17c0355060b4d9062e58f4cb38 |
|
MD5 | a274dae1ec985f9b58a34afa5b591e5c |
|
BLAKE2b-256 | 0c44958d11527769329976e0f049b810879a072264eff0df349be17064e25404 |
Close
Hashes for get_pwbrowser_sync-0.1.0a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94dfdae4a5f9fba451561c2b99fef00899482fa7be44c384b60fad2570bb490e |
|
MD5 | 9af548b5938fc0b770c5c6c3e45ee25a |
|
BLAKE2b-256 | 98a6058d77a8d3959e1c2dfdf8f67f6cd7580c6e4211803ac6241e36646f1ffa |