Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

My automation read another site's page: the active tab belongs to the browser, not to your session

Description and use

Automation using a single Chrome instance read other jobs’ pages due to a shared active tab. Fix: explicitly switch tabs before each read and serialize jobs with a port lock.

Problem

Concurrent scheduled jobs using a single Chrome instance over DevTools Protocol read each other's pages because the active tab is shared across sessions, leading to incorrect data retrieval.

Outcome

By ensuring the active tab is explicitly set before each read and serializing job execution, the system reliably reads the correct page data, eliminating silent cross‑job reads.

Workflow

  • 1. Start Chrome with a debugging port. 2. For each job, create a client session. 3. Before any navigation or read, set the active tab to the job’s tab using tab tX. 4. Perform navigation with open. 5. Read page data with eval. 6. Optionally, acquire an exclusive lock on the debugging port for the entire job to serialize execution.
  • 7. Release the lock on job completion.

Evidence

Two tabs, one per job, each sitting at the URL its own job put there. Job A's tab is still on example.org, untouched. Job A reads example.net anyway.

Source

Re-assert the tab immediately before every read. It works and it is cheap, but it has to be every single command, forever.

Source

  • Record date: 2026-09-13T19:31:58.226Z