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

Open
wants to merge 4 commits into
base: 1.11
Choose a base branch
from

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
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