|
8 | 8 | <a href="https://codecov.io/gh/autoscrape-labs/pydoll" > |
9 | 9 | <img src="https://codecov.io/gh/autoscrape-labs/pydoll/graph/badge.svg?token=40I938OGM9"/> |
10 | 10 | </a> |
11 | | - <img src="https://github.com/thalissonvs/pydoll/actions/workflows/tests.yml/badge.svg" alt="Tests"> |
12 | | - <img src="https://github.com/thalissonvs/pydoll/actions/workflows/ruff-ci.yml/badge.svg" alt="Ruff CI"> |
13 | | - <img src="https://github.com/thalissonvs/pydoll/actions/workflows/mypy.yml/badge.svg" alt="MyPy CI"> |
| 11 | + <img src="https://github.com/autoscrape-labs/pydoll/actions/workflows/tests.yml/badge.svg" alt="Tests"> |
| 12 | + <img src="https://github.com/autoscrape-labs/pydoll/actions/workflows/ruff-ci.yml/badge.svg" alt="Ruff CI"> |
| 13 | + <img src="https://github.com/autoscrape-labs/pydoll/actions/workflows/mypy.yml/badge.svg" alt="MyPy CI"> |
14 | 14 | <img src="https://img.shields.io/badge/python-%3E%3D3.10-blue" alt="Python >= 3.10"> |
15 | 15 | <a href="https://deepwiki.com/autoscrape-labs/pydoll"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a> |
16 | 16 | </p> |
17 | 17 |
|
18 | 18 |
|
19 | 19 | <p align="center"> |
20 | | - 📖 <a href="https://autoscrape-labs.github.io/pydoll/">Documentation</a> • |
| 20 | + 📖 <a href="https://pydoll.tech/">Documentation</a> • |
21 | 21 | 🚀 <a href="#-getting-started">Getting Started</a> • |
22 | 22 | ⚡ <a href="#-advanced-features">Advanced Features</a> • |
23 | 23 | 🤝 <a href="#-contributing">Contributing</a> • |
@@ -97,6 +97,39 @@ await tab.request.get('https://api.example.com/data', headers=headers) |
97 | 97 |
|
98 | 98 | This opens up incredible possibilities for automation scenarios where you need both browser interaction AND API efficiency! |
99 | 99 |
|
| 100 | +### New expect_download() context manager — robust file downloads made easy! |
| 101 | +Tired of fighting with flaky download flows, missing files, or racy event listeners? Meet `tab.expect_download()`, a delightful, reliable way to handle file downloads. |
| 102 | + |
| 103 | +- Automatically sets the browser’s download behavior |
| 104 | +- Works with your own directory or a temporary folder (auto-cleaned!) |
| 105 | +- Waits for completion with a timeout (so your tests don’t hang) |
| 106 | +- Gives you a handy handle to read bytes/base64 or check `file_path` |
| 107 | + |
| 108 | +Tiny example that just works: |
| 109 | + |
| 110 | +```python |
| 111 | +import asyncio |
| 112 | +from pathlib import Path |
| 113 | +from pydoll.browser import Chrome |
| 114 | + |
| 115 | +async def download_report(): |
| 116 | + async with Chrome() as browser: |
| 117 | + tab = await browser.start() |
| 118 | + await tab.go_to('https://example.com/reports') |
| 119 | + |
| 120 | + target_dir = Path('/tmp/my-downloads') |
| 121 | + async with tab.expect_download(keep_file_at=target_dir, timeout=10) as download: |
| 122 | + # Trigger the download in the page (button/link/etc.) |
| 123 | + await (await tab.find(text='Download latest report')).click() |
| 124 | + # Wait until finished and read the content |
| 125 | + data = await download.read_bytes() |
| 126 | + print(f"Downloaded {len(data)} bytes to: {download.file_path}") |
| 127 | + |
| 128 | +asyncio.run(download_report()) |
| 129 | +``` |
| 130 | + |
| 131 | +Want zero-hassle cleanup? Omit `keep_file_at` and we’ll create a temp folder and remove it automatically after the context exits. Perfect for tests. |
| 132 | + |
100 | 133 | ### Total browser control with custom preferences! (thanks to [@LucasAlvws](https://github.com/LucasAlvws)) |
101 | 134 | Want to completely customize how Chrome behaves? **Now you can control EVERYTHING!**<br> |
102 | 135 | The new `browser_preferences` system gives you access to hundreds of internal Chrome settings that were previously impossible to change programmatically. We're talking about deep browser customization that goes way beyond command-line flags! |
@@ -176,7 +209,7 @@ options.browser_preferences = { |
176 | 209 |
|
177 | 210 | This level of control was previously only available to Chrome extension developers - now it's in your automation toolkit! |
178 | 211 |
|
179 | | -Check the [documentation](https://autoscrape-labs.github.io/pydoll/features/#custom-browser-preferences/) for more details. |
| 212 | +Check the [documentation](https://pydoll.tech/docs/features/#custom-browser-preferences/) for more details. |
180 | 213 |
|
181 | 214 | ### New `get_parent_element()` method |
182 | 215 | Retrieve the parent of any WebElement, making it easier to navigate the DOM structure: |
@@ -487,7 +520,7 @@ options.add_argument('--disable-dev-shm-usage') |
487 | 520 |
|
488 | 521 | ## 📚 Documentation |
489 | 522 |
|
490 | | -For complete documentation, detailed examples and deep dives into all Pydoll functionalities, visit our [official documentation](https://autoscrape-labs.github.io/pydoll/). |
| 523 | +For complete documentation, detailed examples and deep dives into all Pydoll functionalities, visit our [official documentation](https://pydoll.tech/). |
491 | 524 |
|
492 | 525 | The documentation includes: |
493 | 526 | - **Getting Started Guide** - Step-by-step tutorials |
|
0 commit comments