Skip to content

Commit c3497ba

Browse files
authored
Merge pull request #369 from autoscrape-labs/fix/go-to-navigation-robustness
Remove humanize True as default and fix tests
2 parents 01d0b68 + 1bfde25 commit c3497ba

File tree

13 files changed

+205
-205
lines changed

13 files changed

+205
-205
lines changed

docs/en/features/automation/human-interactions.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ One of the key differentiators between successful automation and easily-detected
55
!!! info "Feature Status"
66
**Already Implemented:**
77

8-
- **Humanized Keyboard**: Variable typing speed, realistic typos with auto-correction (`humanize=True`)
9-
- **Humanized Scroll**: Physics-based scrolling with momentum, friction, jitter, and overshoot (`humanize=True`)
10-
- **Humanized Mouse**: Bezier curve paths, Fitts's Law timing, minimum-jerk velocity, tremor, and overshoot (`humanize=True`)
8+
- **Humanized Keyboard**: Variable typing speed, realistic typos with auto-correction (pass `humanize=True`)
9+
- **Humanized Scroll**: Physics-based scrolling with momentum, friction, jitter, and overshoot (pass `humanize=True`)
10+
- **Humanized Mouse**: Bezier curve paths, Fitts's Law timing, minimum-jerk velocity, tremor, and overshoot (pass `humanize=True`)
1111

1212
**Coming Soon:**
1313

@@ -195,14 +195,14 @@ Pydoll's keyboard API provides two typing modes to balance speed and stealth.
195195
!!! info "Understanding Typing Modes"
196196
| Mode | Parameters | Behavior | Use Case |
197197
|------|------------|----------|----------|
198-
| **Default (Humanized)** | `humanize=True` | Variable timing, ~2% typo rate with auto-correction | **Anti-bot evasion** (default) |
199-
| **Fast** | `humanize=False` | Fixed 50ms intervals, no typos | Speed-critical, low-risk scenarios |
198+
| **Default (Fast)** | `humanize=False` | Fixed 50ms intervals, no typos | Speed-critical, low-risk scenarios (default) |
199+
| **Humanized** | `humanize=True` | Variable timing, ~2% typo rate with auto-correction | **Anti-bot evasion** |
200200

201-
The `interval` parameter is deprecated. Use the default `humanize=True` for realistic typing.
201+
The `interval` parameter is deprecated. Pass `humanize=True` for realistic typing.
202202

203203
### Natural Typing with Humanization
204204

205-
By default, `type_text()` uses humanized mode, simulating realistic human typing with variable speeds and occasional typos that are automatically corrected:
205+
When `humanize=True` is passed, `type_text()` uses humanized mode, simulating realistic human typing with variable speeds and occasional typos that are automatically corrected:
206206

207207
```python
208208
import asyncio
@@ -218,8 +218,8 @@ async def natural_typing():
218218

219219
# Variable speed: 30-120ms between keystrokes
220220
# ~2% typo rate with realistic correction behavior
221-
await username_field.type_text("john.doe@example.com") # humanize=True by default
222-
await password_field.type_text("MyC0mpl3xP@ssw0rd!")
221+
await username_field.type_text("john.doe@example.com", humanize=True)
222+
await password_field.type_text("MyC0mpl3xP@ssw0rd!", humanize=True)
223223

224224
asyncio.run(natural_typing())
225225
```
@@ -239,14 +239,14 @@ async def fast_vs_realistic_input():
239239

240240
username = await tab.find(id="username")
241241
await username.click()
242-
await username.type_text("john_doe") # humanize=True by default
242+
await username.type_text("john_doe", humanize=True)
243243

244244
hidden_field = await tab.find(id="hidden-token")
245245
await hidden_field.insert_text("very-long-generated-token-12345678")
246246

247247
comment = await tab.find(id="comment-box")
248248
await comment.click()
249-
await comment.type_text("This looks like human input!") # humanize=True by default
249+
await comment.type_text("This looks like human input!", humanize=True)
250250

251251
asyncio.run(fast_vs_realistic_input())
252252
```
@@ -263,11 +263,11 @@ Pydoll provides a dedicated scroll API that waits for scroll completion before p
263263

264264
| Mode | Parameters | Behavior | Use Case |
265265
|------|------------|----------|----------|
266-
| **Humanized (Default)** | `humanize=True` | Physics engine with momentum, jitter, overshoot | **Anti-bot evasion** (default) |
267-
| **Smooth** | `humanize=False, smooth=True` | CSS-based animation, predictable | General browsing simulation |
268-
| **Instant** | `humanize=False, smooth=False` | Teleports to position immediately | Speed-critical operations |
266+
| **Smooth (Default)** | `smooth=True` | CSS-based animation, predictable | General browsing simulation (default) |
267+
| **Humanized** | `humanize=True` | Physics engine with momentum, jitter, overshoot | **Anti-bot evasion** |
268+
| **Instant** | `smooth=False` | Teleports to position immediately | Speed-critical operations |
269269

270-
Humanized scrolling is now the default. Pass `humanize=False` to use CSS-based or instant scrolling.
270+
Pass `humanize=True` for physics-based humanized scrolling to evade bot detection.
271271

272272
### Basic Directional Scrolling
273273

@@ -283,10 +283,10 @@ async def basic_scrolling():
283283
tab = await browser.start()
284284
await tab.go_to('https://example.com/long-page')
285285

286-
# Humanized (default) - physics engine with Bezier curves
286+
# Humanized - physics engine with Bezier curves
287287
# Includes: momentum, friction, jitter, micro-pauses, overshoot
288-
await tab.scroll.by(ScrollPosition.DOWN, 500)
289-
await tab.scroll.by(ScrollPosition.UP, 300)
288+
await tab.scroll.by(ScrollPosition.DOWN, 500, humanize=True)
289+
await tab.scroll.by(ScrollPosition.UP, 300, humanize=True)
290290

291291
# CSS-based animation - looks nice but predictable timing
292292
await tab.scroll.by(ScrollPosition.DOWN, 500, humanize=False, smooth=True)
@@ -313,10 +313,10 @@ async def scroll_to_positions():
313313
# Read the beginning of the article
314314
await asyncio.sleep(2.0)
315315

316-
# Humanized scroll (default, physics engine, anti-bot evasion)
317-
await tab.scroll.to_bottom()
316+
# Humanized scroll (physics engine, anti-bot evasion)
317+
await tab.scroll.to_bottom(humanize=True)
318318
await asyncio.sleep(1.5)
319-
await tab.scroll.to_top()
319+
await tab.scroll.to_top(humanize=True)
320320

321321
# CSS smooth scroll (predictable animation)
322322
await tab.scroll.to_bottom(humanize=False, smooth=True)
@@ -327,9 +327,9 @@ asyncio.run(scroll_to_positions())
327327
```
328328

329329
!!! tip "Choosing the Right Mode"
330-
- **Default** (`humanize=True`): Best for anti-bot evasion, used automatically
331-
- **`humanize=False, smooth=True`**: Good for demos, screenshots, and general automation
332-
- **`humanize=False, smooth=False`**: Maximum speed when stealth is not a concern
330+
- **`humanize=True`**: Best for anti-bot evasion
331+
- **Default** (`smooth=True`): Good for demos, screenshots, and general automation
332+
- **`smooth=False`**: Maximum speed when stealth is not a concern
333333

334334
### Human-Like Scrolling Patterns
335335

docs/en/features/automation/mouse-control.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Mouse Control
22

3-
The Mouse API provides complete control over mouse input at the page level, enabling you to simulate realistic cursor movement, clicks, double-clicks, and drag operations. By default, all mouse operations use humanized simulation: paths follow natural Bezier curves with Fitts's Law timing, minimum-jerk velocity profiles, physiological tremor, and overshoot correction, making automation virtually indistinguishable from human behavior.
3+
The Mouse API provides complete control over mouse input at the page level, enabling you to simulate realistic cursor movement, clicks, double-clicks, and drag operations. When `humanize=True` is passed, mouse operations use humanized simulation: paths follow natural Bezier curves with Fitts's Law timing, minimum-jerk velocity profiles, physiological tremor, and overshoot correction, making automation virtually indistinguishable from human behavior.
44

55
!!! info "Centralized Mouse Interface"
66
All mouse operations are accessible via `tab.mouse`, providing a clean, unified API for all mouse interactions.
@@ -15,10 +15,10 @@ async with Chrome() as browser:
1515
tab = await browser.start()
1616
await tab.go_to('https://example.com')
1717

18-
# Move cursor to position (humanized by default)
18+
# Move cursor to position
1919
await tab.mouse.move(500, 300)
2020

21-
# Click at position (humanized by default)
21+
# Click at position
2222
await tab.mouse.click(500, 300)
2323

2424
# Right-click
@@ -38,18 +38,18 @@ async with Chrome() as browser:
3838
Move the mouse cursor to a specific position on the page:
3939

4040
```python
41-
# Humanized move (default, curved path with natural timing)
41+
# Default move (single CDP event, no simulation)
4242
await tab.mouse.move(500, 300)
4343

44-
# Instant move (single CDP event, no simulation)
45-
await tab.mouse.move(500, 300, humanize=False)
44+
# Humanized move (curved path with natural timing)
45+
await tab.mouse.move(500, 300, humanize=True)
4646
```
4747

4848
**Parameters:**
4949

5050
- `x`: Target X coordinate (CSS pixels)
5151
- `y`: Target Y coordinate (CSS pixels)
52-
- `humanize` (keyword-only): Simulate human-like curved movement (default: `True`)
52+
- `humanize` (keyword-only): Simulate human-like curved movement (default: `False`)
5353

5454
### click: Click at Position
5555

@@ -58,7 +58,7 @@ Move to position and perform a mouse click:
5858
```python
5959
from pydoll.protocol.input.types import MouseButton
6060

61-
# Left click with humanized movement (default)
61+
# Left click (default, instant)
6262
await tab.mouse.click(500, 300)
6363

6464
# Right click
@@ -67,8 +67,8 @@ await tab.mouse.click(500, 300, button=MouseButton.RIGHT)
6767
# Double click via click_count
6868
await tab.mouse.click(500, 300, click_count=2)
6969

70-
# Instant click without humanization
71-
await tab.mouse.click(500, 300, humanize=False)
70+
# Humanized click with natural movement
71+
await tab.mouse.click(500, 300, humanize=True)
7272
```
7373

7474
**Parameters:**
@@ -77,7 +77,7 @@ await tab.mouse.click(500, 300, humanize=False)
7777
- `y`: Target Y coordinate
7878
- `button` (keyword-only): Mouse button, one of `LEFT`, `RIGHT`, `MIDDLE` (default: `LEFT`)
7979
- `click_count` (keyword-only): Number of clicks (default: `1`)
80-
- `humanize` (keyword-only): Simulate human-like behavior (default: `True`)
80+
- `humanize` (keyword-only): Simulate human-like behavior (default: `False`)
8181

8282
### double_click: Double-Click at Position
8383

@@ -111,39 +111,39 @@ These are primitives that operate at the current cursor position and have no `hu
111111
Move from start to end while holding the mouse button:
112112

113113
```python
114-
# Humanized drag (default)
114+
# Default drag (instant)
115115
await tab.mouse.drag(100, 200, 500, 400)
116116

117-
# Instant drag without humanization
118-
await tab.mouse.drag(100, 200, 500, 400, humanize=False)
117+
# Humanized drag with natural movement
118+
await tab.mouse.drag(100, 200, 500, 400, humanize=True)
119119
```
120120

121121
**Parameters:**
122122

123123
- `start_x`, `start_y`: Start coordinates
124124
- `end_x`, `end_y`: End coordinates
125-
- `humanize` (keyword-only): Simulate human-like drag (default: `True`)
125+
- `humanize` (keyword-only): Simulate human-like drag (default: `False`)
126126

127-
## Disabling Humanization
127+
## Enabling Humanization
128128

129-
All mouse methods default to `humanize=True`. To perform instant, non-humanized operations, pass `humanize=False`:
129+
All mouse methods default to `humanize=False`. To enable humanized simulation with natural Bezier curve paths and realistic timing, pass `humanize=True`:
130130

131131
```python
132-
# Instant move, single CDP mouseMoved event
133-
await tab.mouse.move(500, 300, humanize=False)
132+
# Humanized move, natural curved path with Fitts's Law timing
133+
await tab.mouse.move(500, 300, humanize=True)
134134

135-
# Instant click: move + press + release, no simulation
136-
await tab.mouse.click(500, 300, humanize=False)
135+
# Humanized click: curved movement + pre-click pause + press + release
136+
await tab.mouse.click(500, 300, humanize=True)
137137

138-
# Instant drag, no curves, no pauses
139-
await tab.mouse.drag(100, 200, 500, 400, humanize=False)
138+
# Humanized drag, natural curves and pauses
139+
await tab.mouse.drag(100, 200, 500, 400, humanize=True)
140140
```
141141

142-
This is useful when speed is critical and detection evasion is not a concern, for example in testing environments or internal tools.
142+
This is recommended when detection evasion is important, for example when interacting with sites that employ bot detection.
143143

144144
## Humanized Mode
145145

146-
When `humanize=True` (the default), the mouse module applies multiple layers of realism:
146+
When `humanize=True` is passed, the mouse module applies multiple layers of realism:
147147

148148
### Bezier Curve Paths
149149

@@ -171,18 +171,18 @@ Humanized clicks include a pre-click pause (50–200ms) that simulates the natur
171171

172172
## Automatic Humanized Element Clicks
173173

174-
When you use `element.click()`, the Mouse API is automatically used to produce a realistic Bezier curve movement from the current cursor position to the element center before clicking. This means every `element.click()` call generates natural mouse movement, making element clicks indistinguishable from human behavior.
174+
When you use `element.click(humanize=True)`, the Mouse API is used to produce a realistic Bezier curve movement from the current cursor position to the element center before clicking, making element clicks indistinguishable from human behavior.
175175

176176
```python
177-
# Humanized click (default): Bezier curve movement + click
177+
# Default click: raw CDP press/release
178178
button = await tab.find(id='submit')
179179
await button.click()
180180

181181
# With offset from center
182182
await button.click(x_offset=10, y_offset=5)
183183

184-
# Disable humanization: raw CDP press/release, no cursor movement
185-
await button.click(humanize=False)
184+
# Humanized click: Bezier curve movement + click
185+
await button.click(humanize=True)
186186
```
187187

188188
Position tracking is maintained across element clicks. Clicking element A, then element B, produces a natural curved path from A's position to B.

docs/pt/features/automation/human-interactions.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Um dos principais diferenciais entre uma automação bem-sucedida e bots facilme
55
!!! info "Status das Funcionalidades"
66
**Já Implementado:**
77

8-
- **Teclado Humanizado**: Velocidade de digitação variável, erros realistas com correção automática (`humanize=True`)
9-
- **Scroll Humanizado**: Rolagem baseada em física com momentum, fricção, jitter e overshoot (`humanize=True`)
10-
- **Mouse Humanizado**: Trajetórias com curvas de Bezier, temporização pela Lei de Fitts, velocidade minimum-jerk, tremor e overshoot (`humanize=True`)
8+
- **Teclado Humanizado**: Velocidade de digitação variável, erros realistas com correção automática (passe `humanize=True`)
9+
- **Scroll Humanizado**: Rolagem baseada em física com momentum, fricção, jitter e overshoot (passe `humanize=True`)
10+
- **Mouse Humanizado**: Trajetórias com curvas de Bezier, temporização pela Lei de Fitts, velocidade minimum-jerk, tremor e overshoot (passe `humanize=True`)
1111

1212
**Em Breve:**
1313

@@ -195,14 +195,14 @@ A API de teclado do Pydoll fornece dois modos de digitação para equilibrar vel
195195
!!! info "Entendendo os Modos de Digitação"
196196
| Modo | Parâmetros | Comportamento | Caso de Uso |
197197
|------|------------|---------------|-------------|
198-
| **Padrão (Humanizado)** | `humanize=True` | Timing variável, ~2% de taxa de erros com correção automática | **Evasão anti-bot** (padrão) |
199-
| **Rápido** | `humanize=False` | Intervalos fixos de 50ms, sem erros | Cenários de velocidade, baixo risco |
198+
| **Padrão (Rápido)** | `humanize=False` | Intervalos fixos de 50ms, sem erros | Cenários de velocidade, baixo risco (padrão) |
199+
| **Humanizado** | `humanize=True` | Timing variável, ~2% de taxa de erros com correção automática | **Evasão anti-bot** |
200200

201-
O parâmetro `interval` está obsoleto. Use o padrão `humanize=True` para digitação realista.
201+
O parâmetro `interval` está obsoleto. Passe `humanize=True` para digitação realista.
202202

203203
### Digitação Natural com Humanização
204204

205-
Por padrão, `type_text()` usa modo humanizado, simulando digitação humana realista com velocidades variáveis e erros ocasionais que são corrigidos automaticamente:
205+
Quando `humanize=True` é passado, `type_text()` usa modo humanizado, simulando digitação humana realista com velocidades variáveis e erros ocasionais que são corrigidos automaticamente:
206206

207207
```python
208208
import asyncio
@@ -218,8 +218,8 @@ async def natural_typing():
218218

219219
# Velocidade variável: 30-120ms entre teclas
220220
# ~2% de taxa de erros com comportamento de correção realista
221-
await username_field.type_text("john.doe@example.com") # humanize=True por padrão
222-
await password_field.type_text("MyC0mpl3xP@ssw0rd!")
221+
await username_field.type_text("john.doe@example.com", humanize=True)
222+
await password_field.type_text("MyC0mpl3xP@ssw0rd!", humanize=True)
223223

224224
asyncio.run(natural_typing())
225225
```
@@ -266,11 +266,11 @@ O Pydoll fornece uma API dedicada de scroll que aguarda a conclusão da rolagem
266266

267267
| Modo | Parâmetros | Comportamento | Caso de Uso |
268268
|------|------------|---------------|-------------|
269-
| **Humanizado (Padrão)** | `humanize=True` | Motor de física com momentum, jitter, overshoot | **Evasão anti-bot** (padrão) |
270-
| **Suave** | `humanize=False, smooth=True` | Animação CSS, previsível | Simulação de navegação geral |
271-
| **Instantâneo** | `humanize=False, smooth=False` | Teletransporta para a posição imediatamente | Operações focadas em velocidade |
269+
| **Suave (Padrão)** | `smooth=True` | Animação CSS, previsível | Simulação de navegação geral (padrão) |
270+
| **Humanizado** | `humanize=True` | Motor de física com momentum, jitter, overshoot | **Evasão anti-bot** |
271+
| **Instantâneo** | `smooth=False` | Teletransporta para a posição imediatamente | Operações focadas em velocidade |
272272

273-
A rolagem humanizada é agora o padrão. Passe `humanize=False` para usar rolagem CSS ou instantânea.
273+
Passe `humanize=True` para rolagem humanizada baseada em física para evasão anti-bot.
274274

275275
### Rolagem Básica por Direção
276276

@@ -286,10 +286,10 @@ async def basic_scrolling():
286286
tab = await browser.start()
287287
await tab.go_to('https://example.com/long-page')
288288

289-
# Humanizado (padrão) - motor de física com curvas de Bezier
289+
# Humanizado - motor de física com curvas de Bezier
290290
# Inclui: momentum, fricção, jitter, micro-pausas, overshoot
291-
await tab.scroll.by(ScrollPosition.DOWN, 500)
292-
await tab.scroll.by(ScrollPosition.UP, 300)
291+
await tab.scroll.by(ScrollPosition.DOWN, 500, humanize=True)
292+
await tab.scroll.by(ScrollPosition.UP, 300, humanize=True)
293293

294294
# Animação CSS - visual agradável mas timing previsível
295295
await tab.scroll.by(ScrollPosition.DOWN, 500, humanize=False, smooth=True)
@@ -316,10 +316,10 @@ async def scroll_to_positions():
316316
# Ler o início do artigo
317317
await asyncio.sleep(2.0)
318318

319-
# Scroll humanizado (padrão, motor de física, evasão anti-bot)
320-
await tab.scroll.to_bottom()
319+
# Scroll humanizado (motor de física, evasão anti-bot)
320+
await tab.scroll.to_bottom(humanize=True)
321321
await asyncio.sleep(1.5)
322-
await tab.scroll.to_top()
322+
await tab.scroll.to_top(humanize=True)
323323

324324
# Scroll suave CSS (animação previsível)
325325
await tab.scroll.to_bottom(humanize=False, smooth=True)
@@ -330,9 +330,9 @@ asyncio.run(scroll_to_positions())
330330
```
331331

332332
!!! tip "Escolhendo o Modo Certo"
333-
- **Padrão** (`humanize=True`): Melhor para evasão anti-bot, usado automaticamente
334-
- **`humanize=False, smooth=True`**: Bom para demos, screenshots e automação geral
335-
- **`humanize=False, smooth=False`**: Velocidade máxima quando a furtividade não é uma preocupação
333+
- **`humanize=True`**: Melhor para evasão anti-bot
334+
- **Padrão** (`smooth=True`): Bom para demos, screenshots e automação geral
335+
- **`smooth=False`**: Velocidade máxima quando a furtividade não é uma preocupação
336336

337337
### Padrões de Rolagem Semelhantes a Humanos
338338

0 commit comments

Comments
 (0)