fix: Re-use pre-existing browser context in `PlaywrightBrowserController` by Pijukatel · Pull Request #1778 · apify/crawlee-python

@Pijukatel

Description

  • PlaywrightBrowserController can receive a browser with already active contexts. If that is the case, use the first active context directly in the PlaywrightBrowserController instead of creating a new context

Issues

Testing

  • Added unit test
  • Manual test on snippet reported by the user

Checklist

  • CI passed

@Pijukatel

@codecov

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.20%. Comparing base (944753a) to head (2ce9364).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1778      +/-   ##
==========================================
- Coverage   92.25%   92.20%   -0.05%     
==========================================
  Files         156      156              
  Lines       10654    10654              
==========================================
- Hits         9829     9824       -5     
- Misses        825      830       +5     
Flag Coverage Δ
unit 92.20% <100.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Pijukatel

@Pijukatel Pijukatel marked this pull request as ready for review

March 5, 2026 15:10

Mantisus

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

This should be taken into consideration when working on #1744

vdusek

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Pijukatel Pijukatel deleted the re-use-existing-browser-context branch

March 6, 2026 09:49