Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix consistently failing test: Selector with a wait #135

Merged
merged 4 commits into from
Mar 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions tests/run_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ shot-scraper https://simonwillison.net/ \
# JPEG quality
shot-scraper https://simonwillison.net/ \
-h 800 -o examples/simonwillison-quality-80.jpg --quality 80
# Selector with a wait
# Selector with a wait for remote page element
shot-scraper 'https://www.owlsnearme.com/?place=127871' \
--selector 'section.secondary' \
-o examples/owlsnearme-wait.jpg \
--wait 2000
--wait-for "!!document.querySelector('section.secondary')"
# Accessibility
shot-scraper accessibility https://datasette.io/ \
> examples/datasette-accessibility.json
Expand Down Expand Up @@ -103,6 +103,11 @@ shot-scraper examples/div-after-2-seconds.html \
shot-scraper examples/div-after-2-seconds.html \
-o examples/wait-for.png -w 300 -h 200 \
--wait-for "document.querySelector('div')"
# Selector with a wait
shot-scraper examples/div-after-2-seconds.html \
--selector 'div' \
-o examples/wait.png -w 300 -h 200 \
--wait 2100
# And using multi
echo '# empty file' > empty.yml
shot-scraper multi empty.yml
Expand Down Expand Up @@ -158,6 +163,12 @@ shot-scraper multi empty.yml
height: 200
wait_for: |-
document.querySelector("div")
# wait
- url: div-after-2-seconds.html
output: wait-multi.png
width: 300
height: 200
wait: 2100
' | shot-scraper multi - --fail)
# --bypass-csp
shot-scraper javascript github.com "async () => { await import('https://cdn.jsdelivr.net/npm/left-pad/+esm'); return 'content-security-policy ignored' }" -o examples/github-csp.json --bypass-csp
Expand Down