Purpose
Automate the CAPES Journals Portal Café flow for any institution name: open the Café access page, handle the consent prompt, resolve the institution through the portal autocomplete, select its access control, submit the selection, and extract the visible journal access results.
When to Use
Use when the caller has an institution name but needs the CAPES Café portal to resolve and select that institution before viewing its journal access list. The institution name is an input placeholder, not a fixed value.
Workflow
- Navigate directly to
https://www.periodicos.capes.gov.br/index.php/acesso-cafe.htmlwithdomcontentloaded. - If present, click
button[aria-label="Aceitar"]to dismiss the consent dialog. - Fill
input#select-simplewith{institution}and wait for a visible autocomplete option containing the requested institution. - Select the exact matching
[role="option"]whose normalized text equals{institution}. If the visible option uses additional context, select the unique option whose normalized text starts with or otherwise clearly identifies{institution}; never assume that typing alone establishes the selection. - Check the institution's
input[name="acesso-cafe"]control by clicking its associated label. Resolve the label dynamically from itsforattribute or from label text containing{institution}; theforvalue may be an opaque or acronym-style identifier rather than the full institution name. If the autocomplete selection already checks it, leave it checked. - Submit the selected institution. Prefer
button[aria-label="Exibir lista"]; if that control is absent, use the observed form submit controlbutton#enviarInstituicaoCafe. Wait for navigation when submission navigates, then wait for the result content to settle. - In the same Playwright run, evaluate the following extractor on the resulting page:
(() => {
const visible = (e) => {
if (!e) return false;
const s = getComputedStyle(e),
r = e.getBoundingClientRect();
return (
s.display !== "none" &&
s.visibility !== "hidden" &&
r.width > 0 &&
r.height > 0
);
};
const clean = (s) => (s || "").replace(/\s+/g, " ").trim();
const selected = [
...document.querySelectorAll('input[name="acesso-cafe"]:checked'),
]
.map((input) => {
const label = input.id
? document.querySelector(`label[for="${CSS.escape(input.id)}"]`)
: null;
return clean(label?.innerText || input.value || input.id);
})
.filter(Boolean);
const accessOptions = [...document.querySelectorAll('input[name="acesso-cafe"]')]
.map((input) => {
const label = input.id
? document.querySelector(`label[for="${CSS.escape(input.id)}"]`)
: null;
return {
id: input.id || null,
label: clean(label?.innerText || input.value || input.id),
checked: !!input.checked,
};
})
.filter((x) => x.label);
const links = [
...document.querySelectorAll("main a[href], #content a[href], a[href]"),
]
.filter(visible)
.map((a) => ({ text: clean(a.innerText), href: a.href }))
.filter((x) => x.text || x.href);
const containers = [
...document.querySelectorAll(
"main table tbody tr, #content table tbody tr, main li, #content li, main .card, #content .card",
),
]
.filter(visible)
.map((e) => clean(e.innerText))
.filter(Boolean);
return {
selectedInstitutions: selected,
accessOptions,
visibleEntries: containers,
visibleLinks: links,
};
})();Use one page.goto followed by the required interaction sequence and the final page.evaluate; avoid visiting the homepage or replaying exploratory snapshots.
Site-Specific Gotchas
- The Café page uses the direct
/index.php/acesso-cafe.htmlpath. - Consent is represented by a Portuguese
button[aria-label="Aceitar"]and may not appear on every run. - Institution search is an autocomplete:
input#select-simpledoes not itself establish the selection; choose the exact matching[role="option"]. - The institution checkbox id is institution-specific and can be an acronym-style value such as
INMETRO; never hard-code it. Resolve its associatedlabel[for]orinput[name="acesso-cafe"]dynamically. - The required order is autocomplete selection, institution checkbox selection, then submission through
button[aria-label="Exibir lista"]or the fallbackbutton#enviarInstituicaoCafe. - The result markup can contain mixed list, table, card, and link structures; the extractor intentionally returns both normalized container text and visible links.
- The submit control may trigger navigation after the institution checkbox is selected; wait for that navigation before extracting results.
Expected Output
A JSON object containing selectedInstitutions, all discovered accessOptions with checkbox state, and the displayed page's visibleEntries and visibleLinks.