Skip to content

Commit e6a6223

Browse files
committed
docs: add section about new PAGE_LOAD_STATUS feature
1 parent 9907af2 commit e6a6223

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

public/docs/deep-dive/browser-preferences.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,18 @@ options.browser_preferences = {
3434
## References
3535
- See `pydoll/browser/options.py` for implementation details.
3636
- See tests in `tests/test_browser/test_browser_chrome.py` for usage examples.
37+
38+
## Related: Page Load State
39+
40+
In addition to low-level preferences, you can control when Pydoll considers a page "loaded" by setting `ChromiumOptions.page_load_state`:
41+
42+
- Default: `PageLoadState.COMPLETE` (waits until `document.readyState == 'complete'`)
43+
- Optional: `PageLoadState.INTERACTIVE` (ends earlier when the DOM is interactive)
44+
45+
```python
46+
from pydoll.browser.options import ChromiumOptions
47+
from pydoll.constants import PageLoadState
48+
49+
options = ChromiumOptions()
50+
options.page_load_state = PageLoadState.INTERACTIVE
51+
```

public/docs/features.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,26 @@ options.browser_preferences = {
11641164

11651165
This direct access to Chromium's preference system gives you the same level of control as enterprise administrators and extension developers, making sophisticated browser customization possible within your automation scripts.
11661166

1167+
## Page Load State Control
1168+
1169+
Control when navigations are considered loaded by selecting the page readiness checkpoint used by `tab.go_to()` and internal load waits.
1170+
1171+
- Default: `complete`
1172+
- Optional: `interactive` (ends earlier once the DOM is interactive)
1173+
1174+
```python
1175+
from pydoll.browser.chromium import Chrome
1176+
from pydoll.browser.options import ChromiumOptions
1177+
from pydoll.constants import PageLoadState
1178+
1179+
options = ChromiumOptions()
1180+
options.page_load_state = PageLoadState.INTERACTIVE # default is COMPLETE
1181+
1182+
async with Chrome(options=options) as browser:
1183+
tab = await browser.start()
1184+
await tab.go_to('https://example.com')
1185+
```
1186+
11671187

11681188
## File Upload Support
11691189

public/docs/zh/features.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,26 @@ options.browser_preferences = {
11801180

11811181
这种对 Chromium 首选项系统的直接访问让你拥有与企业管理员、扩展开发者同级别的控制力,使复杂的浏览器定制在自动化脚本中成为可能。
11821182

1183+
## 页面加载状态控制
1184+
1185+
通过设置 `page_load_state` 来控制 `tab.go_to()` 和内部等待何时认为页面“已加载”。
1186+
1187+
- 默认:`complete`
1188+
- 可选:`interactive`(当 DOM 可交互时更早结束等待)
1189+
1190+
```python
1191+
from pydoll.browser.chromium import Chrome
1192+
from pydoll.browser.options import ChromiumOptions
1193+
from pydoll.constants import PageLoadState
1194+
1195+
options = ChromiumOptions()
1196+
options.page_load_state = PageLoadState.INTERACTIVE # 默认是 COMPLETE
1197+
1198+
async with Chrome(options=options) as browser:
1199+
tab = await browser.start()
1200+
await tab.go_to('https://example.com')
1201+
```
1202+
11831203
## 上传文件支持
11841204

11851205
在您的自动化脚本中无缝上传文件:

0 commit comments

Comments
 (0)