How to run EURA 2021 Hanketietopalvelu (eu_playwright)

This howto describes how to run the EURA 2021 Hanketietopalvelu flow (and optionally other EU portals) from the repo, including attaching to an existing Chrome session so the Power BI report UI is already loaded.

Prerequisites

  • Repo root: uv sync --group dev and uv run playwright install chromium done once.
  • Chrome or Chromium with remote debugging (see below) when using --connect.

Quick run (headless)

From the repo root:

# EURA 2021 only
PYTHONPATH=. uv run python -m eu_playwright.cli eura

# All portals (EURA, CORDIS, Partner Search)
PYTHONPATH=. uv run python -m eu_playwright.cli all

Output: tmp/downloaded_data/eu_playwright/eura2021_<slug>_results.json (and others for all).

Attach to an existing Chrome session (recommended for EURA)

The Hanketietopalvelu page is a Power BI report that can take ~10–60 seconds to load. Attaching to a browser where you already have the page open avoids reloads and long waits.

1. Start Chrome with remote debugging

You must use a non-default --user-data-dir (Chrome requires this for remote debugging).

# Linux
google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug
# or
chromium --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug

# macOS
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug

Use any writable directory (e.g. ~/chrome-debug, ./tmp/chrome-debug). Closing that Chrome instance stops the debugging session.

2. Open the EURA page in the first tab

  1. In that Chrome window, open https://eura2021.fi/hanketietopalvelu.
  2. Leave it as the first tab (or close other tabs so it is first). The script attaches to the first tab.
  3. Wait until the Power BI form is visible (e.g. “Name of implementing organisation” and the dropdown).

3. Run the CLI with --connect

From the repo root:

# EURA 2021 only (uses the slicer, applies org name variants, saves JSON)
PYTHONPATH=. uv run python -m eu_playwright.cli eura --connect http://localhost:9222

# All portals (EURA, then CORDIS, then Partner Search)
PYTHONPATH=. uv run python -m eu_playwright.cli all --connect http://localhost:9222

The script connects via CDP, finds the “Name of implementing organisation” slicer (label + dropdown), fills each org name variant, and records results. It does not close the browser.

4. Optional: probe first

To check that the script can see the org slicer before running the full flow:

PYTHONPATH=. uv run python -m eu_playwright.cli probe --connect http://localhost:9222

You should see “Org slicer found in frame: main” (or another frame) if the page is loaded.

Output

  • EURA: tmp/downloaded_data/eu_playwright/eura2021_<slug>_results.json
  • All: same plus cordis_<slug>_results.json and partner_search_<slug>_results.json

Each result has meta (source, organisation, name variants) and results (one entry per org name variant: query, url, success, error, hits, hit_count). “No results found” on the site is recorded as success: true with hits: [].

Options

Option Description
--connect URL Attach to Chrome at URL (e.g. http://localhost:9222).
--out-dir DIR Write JSON under DIR (default: tmp/downloaded_data/eu_playwright).
--no-headless Only relevant when not using --connect; launch a visible browser.
--log-file FILE Redirect CLI output to FILE (UTF-8).

Troubleshooting

  • “Org slicer not found”
    Ensure the first tab is https://eura2021.fi/hanketietopalvelu and the Power BI form is fully loaded (label “Name of implementing organisation” and dropdown visible).

  • “Target page … closed”
    The first tab was something else (e.g. DevTools). Make hanketietopalvelu the first tab and run again.

  • “loading reports failed”
    The site reported an error; the script retries up to 2 times. If it persists, try again later (often transient).

  • Run takes a long time
    The full EURA run uses multiple org name variants; each can involve waiting for the slicer and for results. Allow at least 5–10 minutes when running locally.

See also

  • eu_playwright/README.md – overview and attach instructions.
  • docs/example-funding-and-person-months.md – Example org name variants and context.