function form(selectors) {
        const elems = queryAllVisible(document, selectors, undefined);
        const forms = [];
        for (let elem of elems) {
            const form = elem.form;
            if (form && forms.indexOf(form) < 0) {
                forms.push(form);
            }
        }

        // Try to filter only forms that have some identifying marker
        const markedForms = [];
        for (let form of forms) {
            const props = ["id", "name", "class", "action"];
            for (let marker of FORM_MARKERS) {
                for (let prop of props) {
                    let propValue = form.getAttribute(prop) || "";
                    if (propValue.toLowerCase().indexOf(marker) > -1) {
                        markedForms.push(form);
                    }
                }
            }
        }

        // Try to filter only forms that have a password field
        const formsWithPassword = [];
        for (let form of markedForms) {
            if (find(PASSWORD_FIELDS, form)) {
                formsWithPassword.push(form);
            }
        }

        // Give up and return the first available form, if any
        if (formsWithPassword.length > 0) {
            return formsWithPassword[0];
        }
        if (markedForms.length > 0) {
            return markedForms[0];
        }
        if (forms.length > 0) {
            return forms[0];
        }
        return undefined;
    }
Detect the login form

@since 3.0.0

@param array selectors Selectors to use to find the right form
@return The login form