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
15
function(text, mode) {
    // The one text matcher, behind find_by_text and text locators. Returns
    // matching interactive elements when there are any; otherwise the
    // innermost matching static elements, never their ancestors.
    const needle = mode === 'exact' ? text : text.toLowerCase();
    const matches = el => {
        const raw = (el.innerText || el.textContent || el.value || '').trim();
        return mode === 'exact' ? raw === needle : raw.toLowerCase().includes(needle);
    };
    const interactive = Array.from(document.querySelectorAll('a,button,input[type="submit"],input[type="button"],[role="button"],[onclick]')).filter(matches);
    if (interactive.length) return interactive;
    return Array.from(document.querySelectorAll('label,span,div,p,h1,h2,h3,h4,h5,h6,li,td,th'))
        .filter(matches)
        .filter(el => !Array.from(el.children).some(matches));
}