docs(python): add docs for installing with conda (#6845)

Co-authored-by: Max Schmitt <max@schmitt.mx>
This commit is contained in:
Kumar Aditya 2021-06-03 15:07:43 +05:30 committed by GitHub
parent cc2c6917cf
commit 13b6444bda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 8 deletions

View File

@ -218,14 +218,14 @@ os.environ["SESSION_STORAGE"] = session_storage
# Set session storage in a new context # Set session storage in a new context
session_storage = os.environ["SESSION_STORAGE"] session_storage = os.environ["SESSION_STORAGE"]
await context.add_init_script(storage => { await context.add_init_script("""storage => {
if (window.location.hostname == 'example.com') { if (window.location.hostname == 'example.com') {
entries = JSON.parse(storage) entries = JSON.parse(storage)
Object.keys(entries).forEach(key => { Object.keys(entries).forEach(key => {
window.sessionStorage.setItem(key, entries[key]) window.sessionStorage.setItem(key, entries[key])
}) })
} }
}, session_storage) }""", session_storage)
``` ```
```python sync ```python sync
@ -236,14 +236,14 @@ os.environ["SESSION_STORAGE"] = session_storage
# Set session storage in a new context # Set session storage in a new context
session_storage = os.environ["SESSION_STORAGE"] session_storage = os.environ["SESSION_STORAGE"]
context.add_init_script(storage => { context.add_init_script("""storage => {
if (window.location.hostname == 'example.com') { if (window.location.hostname == 'example.com') {
entries = JSON.parse(storage) entries = JSON.parse(storage)
Object.keys(entries).forEach(key => { Object.keys(entries).forEach(key => {
window.sessionStorage.setItem(key, entries[key]) window.sessionStorage.setItem(key, entries[key])
}) })
} }
}, session_storage) }""", session_storage)
``` ```
```csharp ```csharp
@ -314,7 +314,7 @@ from playwright.async_api import async_playwright
async def main(): async def main():
async with async_playwright() as p: async with async_playwright() as p:
user_data_dir = '/path/to/directory' user_data_dir = '/path/to/directory'
browser = await p.chromium.launch_persistent_context(userDataDir, headless=False) browser = await p.chromium.launch_persistent_context(user_data_dir, headless=False)
# Execute login steps manually in the browser window # Execute login steps manually in the browser window
asyncio.run(main()) asyncio.run(main())

View File

@ -259,11 +259,11 @@ public class Example {
``` ```
```python async ```python async
browser = await playwright.chromium.launch(chromiumSandbox=False) browser = await playwright.chromium.launch(chromium_sandbox=False)
``` ```
```python sync ```python sync
browser = playwright.chromium.launch(chromiumSandbox=False) browser = playwright.chromium.launch(chromium_sandbox=False)
``` ```
```csharp ```csharp

View File

@ -8,13 +8,24 @@ title: "Getting Started"
## Installation ## Installation
Use pip to install Playwright in your Python project. See [system requirements](#system-requirements). See [system requirements](#system-requirements).
### Pip
```bash ```bash
pip install playwright pip install playwright
playwright install playwright install
``` ```
### Conda
```bash
conda config --add channels conda-forge
conda config --add channels microsoft
conda install playwright
playwright install
```
These commands download the Playwright package and install browser binaries for Chromium, Firefox and WebKit. To modify this behavior see [installation parameters](./installation.md). These commands download the Playwright package and install browser binaries for Chromium, Firefox and WebKit. To modify this behavior see [installation parameters](./installation.md).
## Usage ## Usage