Skip to content

feat: Use specialized Playwright docker images in templates#1757

Merged
Pijukatel merged 5 commits intomasterfrom
use-specialized-pw-docker-images
Feb 19, 2026
Merged

feat: Use specialized Playwright docker images in templates#1757
Pijukatel merged 5 commits intomasterfrom
use-specialized-pw-docker-images

Conversation

@Pijukatel
Copy link
Collaborator

@Pijukatel Pijukatel commented Feb 18, 2026

Description

  • Update templates to use a browser-specialized Playwright Docker image
  • Add specialized templates: playwright-chrome, playwright-firefox, playwright-webkit
  • Update e2e tests to include new templates
  • Update PlaywrightBrowserPlugin to not raise an Exception when browser type='chrome' and explicit executable_path is provided as well. Just add debug log instead.

Issues

Testing

  • e2e tests

Checklist

  • CI passed

@github-actions github-actions bot added this to the 134th sprint - Tooling team milestone Feb 18, 2026
@github-actions github-actions bot added t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels Feb 18, 2026
@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.28%. Comparing base (7663404) to head (5dd7346).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/crawlee/browsers/_playwright_browser_plugin.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1757      +/-   ##
==========================================
- Coverage   92.31%   92.28%   -0.03%     
==========================================
  Files         156      156              
  Lines       10644    10645       +1     
==========================================
- Hits         9826     9824       -2     
- Misses        818      821       +3     
Flag Coverage Δ
unit 92.28% <50.00%> (-0.03%) ⬇️

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 force-pushed the use-specialized-pw-docker-images branch 3 times, most recently from 024d605 to e8abc7c Compare February 18, 2026 08:08
@Pijukatel Pijukatel force-pushed the use-specialized-pw-docker-images branch from e8abc7c to e360ccb Compare February 18, 2026 08:18
@Pijukatel
Copy link
Collaborator Author

Pijukatel commented Feb 18, 2026

@Pijukatel Pijukatel marked this pull request as ready for review February 18, 2026 09:37
@Pijukatel Pijukatel requested review from Mantisus and vdusek and removed request for vdusek February 18, 2026 09:38
Copy link
Collaborator

@Mantisus Mantisus left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Crawlee’s cookiecutter project templates to support browser-specific Playwright Docker images and adds dedicated Playwright template variants (Chrome/Firefox/WebKit), while relaxing PlaywrightBrowserPlugin behavior for browser_type='chrome' with an explicit executable_path.

Changes:

  • Add new cookiecutter template options and corresponding main_*.py templates for playwright-chrome, playwright-firefox, and playwright-webkit.
  • Update template routing/dependencies and Dockerfile base images to work consistently across all playwright* crawler types.
  • Expand e2e template coverage and scheduled CI matrix to include the new crawler template variants; adjust PlaywrightBrowserPlugin to log instead of raising for chrome + executable_path.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/e2e/project_template/test_static_crawlers_templates.py Adds e2e coverage for newly introduced Playwright crawler template types.
src/crawlee/project_template/{{cookiecutter.project_name}}/{{cookiecutter.__package_name}}/routes.py Routes all playwright* templates to shared Playwright routes template.
src/crawlee/project_template/{{cookiecutter.project_name}}/requirements.txt Ensures all playwright* templates select the crawlee[playwright] extra; keeps camoufox dependency conditional.
src/crawlee/project_template/{{cookiecutter.project_name}}/pyproject.toml Aligns extras selection so all playwright* templates depend on crawlee[playwright].
src/crawlee/project_template/{{cookiecutter.project_name}}/Dockerfile Switches to browser-specialized Playwright base images for new template variants (and camoufox).
src/crawlee/project_template/templates/routes_playwright_camoufox.py Removes redundant routes template (now shared via routes_playwright.py).
src/crawlee/project_template/templates/main_playwright_chrome.py New template configuring PlaywrightCrawler(browser_type="chrome").
src/crawlee/project_template/templates/main_playwright_firefox.py New template configuring PlaywrightCrawler(browser_type="firefox").
src/crawlee/project_template/templates/main_playwright_webkit.py New template configuring PlaywrightCrawler(browser_type="webkit").
src/crawlee/project_template/cookiecutter.json Adds new crawler type choices for the specialized Playwright templates.
src/crawlee/browsers/_playwright_browser_plugin.py Changes chrome + executable_path handling from raising to debug logging.
.github/workflows/on_schedule_tests.yaml Expands scheduled e2e matrix to run against new crawler template variants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@vdusek vdusek left a comment

Choose a reason for hiding this comment

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

Nice, 4 comments from claude, 2 are nits

Comment on lines 93 to 98
if explicit_browser_launch_options.get(
'executable_path', default_launch_browser_options.get('executable_path')
):
logger.debug(
f'Using browser executable from {default_launch_browser_options["executable_path"]},'
f" which takes precedence over 'chrome' channel."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Bug: Debug log message reports wrong executable path

File: src/crawlee/browsers/_playwright_browser_plugin.py

The condition checks explicit_browser_launch_options.get('executable_path',
default_launch_browser_options.get('executable_path')) to determine if an
executable path is set, but the log message always formats
default_launch_browser_options["executable_path"]. When the user passes
executable_path via browser_launch_options, the log will display the wrong
path (the default one, not the user-provided one).

Suggestion:

effective_path = explicit_browser_launch_options.get(
'executable_path', default_launch_browser_options.get('executable_path')
)
if effective_path:
logger.debug(
f"Using browser executable from {effective_path},"
f" which takes precedence over 'chrome' channel."
)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated

@@ -0,0 +1,14 @@
# % extends 'main.py'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Closing parenthesis formatting

Files: templates/main_playwright_chrome.py,
templates/main_playwright_firefox.py, templates/main_playwright_webkit.py

The closing ) is on the same line as the last argument:

  {{ self.http_client_instantiation() }})

Consider:

  {{ self.http_client_instantiation() }}

)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@Pijukatel Pijukatel requested a review from vdusek February 19, 2026 08:50
Copy link
Collaborator

@vdusek vdusek left a comment

Choose a reason for hiding this comment

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

LGTM, but undo the "from -> rom" change

@@ -1,4 +1,4 @@
from crawlee.crawlers import PlaywrightCrawlingContext
rom crawlee.crawlers import PlaywrightCrawlingContext
Copy link
Collaborator

Choose a reason for hiding this comment

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

🙂

Suggested change
rom crawlee.crawlers import PlaywrightCrawlingContext
from crawlee.crawlers import PlaywrightCrawlingContext

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ohh, I remember deleting this file completely...

@Pijukatel Pijukatel merged commit 747c0cf into master Feb 19, 2026
73 of 74 checks passed
@Pijukatel Pijukatel deleted the use-specialized-pw-docker-images branch February 19, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use new docker images in crawlee cli templates

3 participants

Comments