fix: keep init scripts available to page actions#361
Closed
malsabbagh05 wants to merge 2 commits into
Closed
Conversation
Register the normal context-level init script as before, then add a marker script to detect whether the browser backend actually ran it. If the marker is missing after navigation, apply the configured init script to the active page before user callbacks run.
|
Ran a local review/validation pass against commit Validation: python -m compileall -q scrapling/engines/_browsers tests/fetchers/async/test_stealth_session.py
python -m pytest tests/fetchers/async/test_stealth_session.py::TestAsyncStealthySession::test_init_script_is_available_in_page_action -q
python -m pytest tests/fetchers/async/test_stealth_session.py tests/fetchers/sync/test_stealth_session.py tests/fetchers/async/test_dynamic_session.py tests/fetchers/sync/test_dynamic.py -q
python -m ruff check scrapling/engines/_browsers/_base.py scrapling/engines/_browsers/_controllers.py scrapling/engines/_browsers/_stealth.py tests/fetchers/async/test_stealth_session.py
git diff --check origin/dev...HEADResults: targeted regression passed ( I also checked the control flow around |
Contributor
|
Thanks for clarifying. That makes sense: my local pass only validated that this patch made the |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
init_scriptregistrationpage_actiononly when the marker is missingTests
Result:
Also verified the original issue shape against
https://example.com, wherepage_actionobservedseen [2].Fixes #350