mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
docs(python): add docs for installing with conda (#6845)
Co-authored-by: Max Schmitt <max@schmitt.mx>
This commit is contained in:
parent
cc2c6917cf
commit
13b6444bda
@ -218,14 +218,14 @@ os.environ["SESSION_STORAGE"] = session_storage
|
||||
|
||||
# Set session storage in a new context
|
||||
session_storage = os.environ["SESSION_STORAGE"]
|
||||
await context.add_init_script(storage => {
|
||||
await context.add_init_script("""storage => {
|
||||
if (window.location.hostname == 'example.com') {
|
||||
entries = JSON.parse(storage)
|
||||
Object.keys(entries).forEach(key => {
|
||||
window.sessionStorage.setItem(key, entries[key])
|
||||
})
|
||||
}
|
||||
}, session_storage)
|
||||
}""", session_storage)
|
||||
```
|
||||
|
||||
```python sync
|
||||
@ -236,14 +236,14 @@ os.environ["SESSION_STORAGE"] = session_storage
|
||||
|
||||
# Set session storage in a new context
|
||||
session_storage = os.environ["SESSION_STORAGE"]
|
||||
context.add_init_script(storage => {
|
||||
context.add_init_script("""storage => {
|
||||
if (window.location.hostname == 'example.com') {
|
||||
entries = JSON.parse(storage)
|
||||
Object.keys(entries).forEach(key => {
|
||||
window.sessionStorage.setItem(key, entries[key])
|
||||
})
|
||||
}
|
||||
}, session_storage)
|
||||
}""", session_storage)
|
||||
```
|
||||
|
||||
```csharp
|
||||
@ -314,7 +314,7 @@ from playwright.async_api import async_playwright
|
||||
async def main():
|
||||
async with async_playwright() as p:
|
||||
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
|
||||
|
||||
asyncio.run(main())
|
||||
|
@ -259,11 +259,11 @@ public class Example {
|
||||
```
|
||||
|
||||
```python async
|
||||
browser = await playwright.chromium.launch(chromiumSandbox=False)
|
||||
browser = await playwright.chromium.launch(chromium_sandbox=False)
|
||||
```
|
||||
|
||||
```python sync
|
||||
browser = playwright.chromium.launch(chromiumSandbox=False)
|
||||
browser = playwright.chromium.launch(chromium_sandbox=False)
|
||||
```
|
||||
|
||||
```csharp
|
||||
|
@ -8,13 +8,24 @@ title: "Getting Started"
|
||||
|
||||
## Installation
|
||||
|
||||
Use pip to install Playwright in your Python project. See [system requirements](#system-requirements).
|
||||
See [system requirements](#system-requirements).
|
||||
|
||||
### Pip
|
||||
|
||||
```bash
|
||||
pip install playwright
|
||||
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).
|
||||
|
||||
## Usage
|
||||
|
Loading…
x
Reference in New Issue
Block a user