Instantiate a playwright chromium (sync as opposed to async) browser
Project description
get-pwbrowser-sync
Instantiate a playwright firefox 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
File details
Details for the file get_pwbrowser_sync-0.1.3.tar.gz
.
File metadata
- Download URL: get_pwbrowser_sync-0.1.3.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.10 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9ced3243361f43dab6157376e708a5e5b9548d298cbb1e91c08cf2c329eded0 |
|
MD5 | 4c581c8827c3b95da9e8f1fc73b433ea |
|
BLAKE2b-256 | 0fd7e6b9bdda4f0fad5b2caffade5358b02928df93369a8ab40a92090ce9565d |
File details
Details for the file get_pwbrowser_sync-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: get_pwbrowser_sync-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.10 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 653356b726ce72f7aaf7797e17857175201abb959832a99d388ae608b0964380 |
|
MD5 | b66fae98d08cccac9275262dd0e8227e |
|
BLAKE2b-256 | 000ed6596444ab1dc15fd4e96988ca42d9caf155d3d187cc2584a1ad54e2a79f |