Skip to content

Commit e8abc7c

Browse files
committed
Update tesmplates and e2e tests to use specialized Playwright docker images
1 parent 7663404 commit e8abc7c

File tree

10 files changed

+61
-24
lines changed

10 files changed

+61
-24
lines changed

.github/workflows/on_schedule_tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
fail-fast: false
2525
max-parallel: 12
2626
matrix:
27-
crawler-type: ["playwright_camoufox", "playwright", "parsel", "beautifulsoup"]
28-
http-client: [ "httpx", "curl_impersonate"]
27+
crawler-type: ["playwright_camoufox", "playwright_chrome", "playwright_firefox", "playwright_webkit", "playwright", "parsel", "beautifulsoup"]
28+
http-client: ["httpx", "curl_impersonate"]
2929
package-manager: ["pip", "uv", "poetry"]
3030

3131
runs-on: "ubuntu-latest"

src/crawlee/project_template/cookiecutter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"project_name": "crawlee-python-project",
33
"__package_name": "{{ cookiecutter.project_name|lower|replace('-', '_') }}",
4-
"crawler_type": ["beautifulsoup", "parsel", "playwright", "playwright-camoufox"],
4+
"crawler_type": ["beautifulsoup", "parsel", "playwright", "playwright-camoufox", "playwright-chrome", "playwright-firefox", "playwright-webkit"],
55
"__crawler_type": "{{ cookiecutter.crawler_type|lower|replace('-', '_') }}",
66
"http_client": ["impit", "httpx", "curl-impersonate"],
77
"package_manager": ["poetry", "pip", "uv"],
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# % extends 'main.py'
2+
3+
# % block import
4+
from crawlee.crawlers import PlaywrightCrawler
5+
# % endblock
6+
7+
# % block instantiation
8+
crawler = PlaywrightCrawler(
9+
request_handler=router,
10+
headless=True,
11+
max_requests_per_crawl=10,
12+
browser_type="chrome",
13+
{{ self.http_client_instantiation() }})
14+
# % endblock
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# % extends 'main.py'
2+
3+
# % block import
4+
from crawlee.crawlers import PlaywrightCrawler
5+
# % endblock
6+
7+
# % block instantiation
8+
crawler = PlaywrightCrawler(
9+
request_handler=router,
10+
headless=True,
11+
max_requests_per_crawl=10,
12+
browser_type="firefox",
13+
{{ self.http_client_instantiation() }})
14+
# % endblock
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# % extends 'main.py'
2+
3+
# % block import
4+
from crawlee.crawlers import PlaywrightCrawler
5+
# % endblock
6+
7+
# % block instantiation
8+
crawler = PlaywrightCrawler(
9+
request_handler=router,
10+
headless=True,
11+
max_requests_per_crawl=10,
12+
browser_type="webkit",
13+
{{ self.http_client_instantiation() }})
14+
# % endblock

src/crawlee/project_template/templates/routes_playwright_camoufox.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/crawlee/project_template/{{cookiecutter.project_name}}/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
# % if cookiecutter.crawler_type == 'playwright'
55
FROM apify/actor-python-playwright:3.13
66
# % elif cookiecutter.crawler_type == 'playwright-camoufox'
7-
# Currently camoufox has issues installing on Python 3.13
8-
FROM apify/actor-python-playwright:3.12
7+
FROM apify/actor-python-playwright-camoufox:3.13
8+
# % elif cookiecutter.crawler_type == 'playwright-chrome'
9+
FROM apify/actor-python-playwright-chrome:3.13
10+
# % elif cookiecutter.crawler_type == 'playwright-firefox'
11+
FROM apify/actor-python-playwright-firefox:3.13
12+
# % elif cookiecutter.crawler_type == 'playwright-webkit'
13+
FROM apify/actor-python-playwright-webkit:3.13
914
# % else
1015
FROM apify/actor-python:3.13
1116
# % endif

src/crawlee/project_template/{{cookiecutter.project_name}}/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# % if cookiecutter.crawler_type == 'playwright-camoufox'
22
camoufox[geoip]~=0.4.5
3+
# % endif
4+
# % if cookiecutter.crawler_type.startswith('playwright')
35
# % set extras = ['playwright']
46
# % else
57
# % set extras = [cookiecutter.crawler_type]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
# % if cookiecutter.crawler_type.startswith('playwright')
2+
# % include 'routes_playwright.py'
3+
# % else
14
# % include 'routes_%s.py' % cookiecutter.__crawler_type
5+
# % endif

tests/e2e/project_template/test_static_crawlers_templates.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
'crawler_type',
2121
[
2222
pytest.param('playwright-camoufox', marks=pytest.mark.playwright_camoufox),
23+
pytest.param('playwright-chrome', marks=pytest.mark.playwright_chrome),
24+
pytest.param('playwright-firefox', marks=pytest.mark.playwright_firefox),
25+
pytest.param('playwright-webkit', marks=pytest.mark.playwright_webkit),
2326
pytest.param('playwright', marks=pytest.mark.playwright),
2427
pytest.param('parsel', marks=pytest.mark.parsel),
2528
pytest.param('beautifulsoup', marks=pytest.mark.beautifulsoup),

0 commit comments

Comments
 (0)