Humanized input
With humanize, the SDK runs mouse movement, clicks, scrolling and typing along human-like paths and timing. showCursor draws the pointer so you can watch it.
Humanized input (humanize & showCursor)
Pass humanize and all input — moving, clicking, dragging, scrolling, and typing — runs through one humanized standard, at both the page level (page.click / hover / type / fill / mouse.* / keyboard.type) and the locator level (locator.click / type / fill / pressSequentially / dragTo / …). Moves follow a slightly bowed cubic-bézier path built from the last cursor position, walked as a min-jerk sum-of-sub-movements (a ballistic primary + corrective move — the multi-peak velocity of real reaching, not one symmetric bell), and everything is dispatched as real, trusted events (isTrusted === true, and navigator.webdriver stays false). On Pro, coordinate clicks (mouse.click(x, y)) follow motion recorded from real people; everything else, and every click on the open build and Free with GitHub, uses generated paths. Add showCursor to draw a dot that follows the motion so you can watch it.
Because moves use native input, a button pressed with mouse.down() stays held across the move — so down → move → up is a real held-button drag (drag-to-position controls such as sliders get a genuinely pressed drag), and locator.dragTo is humanized too. Typing goes key-by-key with randomised inter-key timing + word-boundary pauses, the occasional fat-finger correction and key rollover: on some fast pairs the next key goes down before the previous one comes up, at a rate fixed per identity (SDK 0.41.1). fill clicks into the field and types it out (a value over 200 characters is clicked into first and then inserted in one go, so bulk fills don't crawl).
Scrolling moves in whole mouse-wheel notches, in short flicks with the occasional reading pause, and moves the pointer over the content first when it isn't already there. A browser reports every wheel event as one full notch, and a real notch moves 100 px on Windows, 120 on Linux and 40 on macOS, so the notch follows the platform the page reports and a requested distance is rounded to the nearest notch, at least one: mouse.wheel(0, 800) scrolls 800 px on a Windows identity and 840 on a Linux one (SDK 0.41.1).
Forms (SDK 0.48.0)
fill follows the kind of field. Text is typed, after a clear with held keys only when the field has a value, and the result is checked; a range slider is dragged to the exact value; a date, time, month, week or date-time field is typed segment by segment in the order the browser shows them. A value a field cannot hold raises Playwright's own error, as before.
selectOption opens a drop-down with a click, types the start of the option's label (spaces included) and confirms with Enter, so the page sees one trusted change, not one per row; rows that can't be typed to are reached with a held arrow key. A list box is scrolled with the wheel and picked with row clicks, Ctrl held for the extra rows of a multi-select. check / uncheck click only when the state has to change.
Typing slips are never made in password, e-mail, number, phone, URL or one-time-code fields, or in a field inside a frame, and only what actually landed is corrected. CLEARCOTE_HUMANIZE_TYPO_RATE sets the rate per key (default 0.02; 0 turns slips off). Every click option is honoured (button, click count, hold, modifiers, position, force, trial), every Playwright locator works, and the check that a click point is not covered uses the browser's own hit test, so the pointer never moves before its path and nothing is pressed early.
Timing and aim (SDK 0.49.0)
Mouse paths, drags and ambient_motion / ambientMotion keep the duration they were planned with, also on a busy machine. Some paths pass the target and come back, at a rate fixed per identity, and a drag with the button held stays within a few pixels of its line, so a slider handle stays on its track. Every press the SDK makes itself comes after a short pause once the pointer has arrived (40 to 250 ms, typical length fixed per identity).
A control under a layer that lets clicks through (a gradient, an icon, a floating label) is clicked like any other. trial runs Playwright's checks and performs no input at all. A field with a maximum length or an input mask (an expiry date, a phone number) is typed once, never cleared and typed again, and date and time fields are typed with the same key timing as text. Errors are Playwright's own, worded the same way.
In Python, Node and .NET (.NET since 0.58.0), a coordinate click (mouse.click(x, y)) can be walked and pressed by the browser engine itself; on engines up to 154 r39 that press comes about 10 ms after the pointer arrives, without the pause. CLEARCOTE_HUMANIZE_ENGINE_CLICKS=off keeps every click on the SDK's path, and =all (opt-in) also sends selector clicks to the engine.
from clearcote import launch
browser = launch(fingerprint="seed-123", humanize=True, show_cursor=True)
page = browser.new_page()
page.goto("https://example.com")
page.click("text=Sign in") # eased curve, then a trusted click
page.fill("#email", "you@example.com") # focus + key-by-key human typing
page.locator("#password").type("s3cr3t") # locators are humanized too
# held-button drag (e.g. a slider): the press stays held across the move
x0, y0, x1 = 100, 300, 400 # the handle's start, and where to release it
page.mouse.move(x0, y0); page.mouse.down()
page.mouse.move(x1, y0); page.mouse.up()
browser.close()Press and hold
Some controls act only while the button stays down: a hold-to-confirm button, a long-press menu, a press-and-hold button that fills up before it accepts. press_and_hold / pressAndHold / PressAndHoldAsync makes one long, humanized press on an element. With humanize it is on the page (page.press_and_hold(selector)) and on every locator (locator.press_and_hold()), frame locators included; the module function press_and_hold(locator) works on any page. The async API (clearcote.async_api) has the same names, awaited.
It waits for the element to be visible and brings it into view (the humanized wheel scroll), glides the pointer to a point near its centre shaped by the identity (or to position, relative to the element's top-left as in Playwright), pauses briefly and presses. The button stays down for duration milliseconds, by default a fresh 2.8 to 3.8 s, or until until returns true: it is asked every 100 ms, duration is then the longest the hold may last (15 s when not given), and the button is let go after a human reaction delay of 160 to 350 ms, not on the same tick the condition changed.
While the button is down, a resting hand still moves the mouse now and then: a sparse whole-pixel drift, never more than 2 px from the press point, every move a trusted one with the button reported held. tremor=False / tremor: false keeps the pointer still. button picks left, right or middle, and timeout is how long to wait for the element to become visible. The call returns true when the hold ran its full time or until became true, and false when until never did. The button is always released, also when until throws; in the async API, until may be an async function, and cancelling the call releases the button too.
from clearcote import launch, press_and_hold
browser = launch(fingerprint="seed-123", humanize=True)
page = browser.new_page()
page.goto("https://example.com")
# hold until the button reports it is done (at most 15 s), then let go
done = page.press_and_hold(
"#hold", until=lambda: page.locator("#hold[data-state=done]").count() > 0
)
print(done) # False if the state never changed
# a fixed 4-second hold, pressed 20 px in from the left edge
page.locator("#confirm").press_and_hold(4000, position={"x": 20, "y": 10})
# a control inside an iframe
frame = page.frame_locator("iframe#widget")
frame.locator("#hold").press_and_hold(
until=lambda: frame.locator("#hold[data-state=done]").count() > 0
)
# the module function works on any Playwright page
press_and_hold(page.locator("#menu-item"), 1200)
browser.close()