MCPcopy Create free account
hub / github.com/HasData/cloudflare-bypass / human_behavior

Function human_behavior

Python/human_behavior.py:6–32  ·  view source on GitHub ↗
(page)

Source from the content-addressed store, hash-verified

4from playwright_stealth import stealth_async
5
6async def human_behavior(page):
7 # random mouse moves
8 for _ in range(5):
9 x = random.randint(100, 800)
10 y = random.randint(100, 600)
11 await page.mouse.move(x, y, steps=random.randint(5, 25))
12 await asyncio.sleep(random.uniform(0.2, 0.6))
13
14 # scroll down in chunks
15 for _ in range(3):
16 await page.evaluate("""() => {
17 window.scrollBy(0, window.innerHeight * 0.8);
18 }""")
19 await asyncio.sleep(random.uniform(0.5, 1.2))
20
21 # small pause, then scroll up
22 await asyncio.sleep(random.uniform(0.5, 1.0))
23 await page.evaluate("""() => {
24 window.scrollBy(0, -window.innerHeight * 0.5);
25 }""")
26 await asyncio.sleep(random.uniform(0.3, 0.8))
27
28 # click a random point
29 bx = random.randint(50, 750)
30 by = random.randint(50, 550)
31 await page.mouse.click(bx, by)
32 await asyncio.sleep(random.uniform(1.0, 2.0))
33
34
35async def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected