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 could not find node with given id #620

Merged
merged 5 commits into from
Nov 6, 2024

Conversation

Seriyyy95
Copy link
Contributor

It is a fix for issue 469

Previously, a new Dom instance was created for each call of $page->dom(). In this pull request, I have stored $dom as a variable in the Page class and added an auto-update of the root node id using the DOM.documentUpdated event. 

I use waitForData() from upcoming chrome-php/wrench 1.7 to process all events before each request without blocking execution if there is no data to process. When the page is refreshed in Chrome, chrome-php will be notified about it before making any requests. Somehow, Chrome fires two DOM.documentUpdated events during one reload, so I decided to not fetch the node ID in the event handler but just mark the node as stale and request a new node ID before making a request if the old one is stale.

.gitignore Outdated Show resolved Hide resolved
composer.json Outdated Show resolved Hide resolved
src/Communication/Socket/MockSocket.php Outdated Show resolved Hide resolved
src/Communication/Socket/MockSocket.php Outdated Show resolved Hide resolved
src/Communication/Socket/SocketInterface.php Outdated Show resolved Hide resolved
@GrahamCampbell GrahamCampbell changed the base branch from 1.11 to 1.12 November 6, 2024 10:22
@GrahamCampbell GrahamCampbell reopened this Nov 6, 2024
@GrahamCampbell GrahamCampbell merged commit 3bbeb45 into chrome-php:1.12 Nov 6, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants