eoka 0.17.1

Stealth browser automation for Rust. Puppeteer/Playwright alternative with anti-bot bypass.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function(query, pick) {
    const all = (() => {
        if (query.kind === 'css') return Array.from(document.querySelectorAll(query.selector));
        if (query.kind === 'placeholder') return Array.from(document.querySelectorAll('[placeholder]')).filter(el => el.getAttribute('placeholder') === query.text);
        if (query.kind === 'role') return Array.from(document.querySelectorAll('[role]')).filter(el => el.getAttribute('role') === query.role);
        if (query.kind !== 'text') throw new Error('Unsupported locator');
        return (TEXT_CANDIDATES)(query.text, query.exact ? 'exact' : 'contains');
    })();
    // No pick: every match. Otherwise one element or null; without an index,
    // more than one match is ambiguous.
    if (pick === null) return all;
    if (pick.index === null && all.length > 1) throw new Error(AMBIGUOUS);
    return all[pick.index ?? 0] ?? null;
}