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
|
# 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())
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user