Skip Menu |

This queue is for tickets about the WWW-Mechanize-Chrome CPAN distribution.

Report information
The Basics
Id: 122881
Status: resolved
Priority: 0/
Queue: WWW-Mechanize-Chrome

People
Owner: Nobody in particular
Requestors: ANDK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.06
Fixed in: 0.07



Subject: After ->get_set_value the $mech object blows up on next call to ->current_form->get_text
Hi Max, I'd like to ask for some guidance once again and hope you can provide some. In my commit https://github.com/andk/WWW-Mechanize-Chrome/commit/52fe3007336b56604366d8a903bac8e1d1669fa7 I have added tests to t/50-form2.t that illustrate what the subject line says. When I run 50-form2.t after this commit, it consistently dies after "ok 13 - The objectId still matches /injectedScriptId/". The diagnostics that follow say: : Could not find node with given id : : -32000 at /home/andk/src/WWW-Mechanize-Chrome/blib/lib/Chrome/DevToolsProtocol.pm line 302 : # Looks like you planned 22 tests but ran 13. : Dubious, test returned 255 (wstat 65280, 0xff00) : Failed 9/22 subtests When I trace the program I stumble over an 'Ignored message' that is about 'method' => 'DOM.attributeModified' which may or may not be a hint that on_response is required to do something when the message arrives. Do you have a suggestion what to try to get this internal state adjusted?
Subject: Re: [rt.cpan.org #122881] After ->get_set_value the $mech object blows up on next call to ->current_form->get_text
Date: Wed, 23 Aug 2017 19:09:02 +0200
To: bug-WWW-Mechanize-Chrome [...] rt.cpan.org
From: Max Maischein <corion [...] corion.net>
Hello Andreas, thank you very much for trying out W:M:Chrome and for providing me with so good test cases! Show quoted text
> Hi Max, I'd like to ask for some guidance once again and hope you can provide some. > > In my commit https://github.com/andk/WWW-Mechanize-Chrome/commit/52fe3007336b56604366d8a903bac8e1d1669fa7 I have added tests to t/50-form2.t that illustrate what the subject line says. > > When I run 50-form2.t after this commit, it consistently dies after "ok 13 - The objectId still matches /injectedScriptId/". The diagnostics that follow say: > > : Could not find node with given id > : > : -32000 at /home/andk/src/WWW-Mechanize-Chrome/blib/lib/Chrome/DevToolsProtocol.pm line 302 > : # Looks like you planned 22 tests but ran 13. > : Dubious, test returned 255 (wstat 65280, 0xff00) > : Failed 9/22 subtests > > When I trace the program I stumble over an 'Ignored message' that is about 'method' => 'DOM.attributeModified' which may or may not be a hint that on_response is required to do something when the message arrives. > > Do you have a suggestion what to try to get this internal state adjusted? >
No, I don't have a good idea what causes this and how to best remedy this. In theory, the opaque objectId of the form should stay the same even if elements of it are modified, but it seems that Chrome forgets the objectId of the FORM element. Maybe a workaround is to clear all objectIds when seeing a DOM.attributeModified message, but that strikes me as a very rough approach. Also, this is not documented anywhere in the DOM.attributeModified message. But as it clearly depends on $mech->field('id', 99); getting called, the objectId somehow gets lost between calls. This is unfortunate, but maybe I have to find a way to tell Chrome to keep some of those references alive... -max
Subject: Re: [rt.cpan.org #122881] After ->get_set_value the $mech object blows up on next call to ->current_form->get_text
Date: Wed, 23 Aug 2017 22:57:27 +0200
To: bug-WWW-Mechanize-Chrome [...] rt.cpan.org
From: Max Maischein <corion [...] corion.net>
Hello again, I've pushed a preliminary fix/workaround to github at https://github.com/Corion/WWW-Mechanize-Chrome/commit/3e383913c5d992646e43d2498de5c4fa28889926 This really slows down the tests until I get to implementing a DOM nodeId cache and invalidating that cache, likely whenever the attributeModified message is received. If that change works for you (or fails for you), please tell me! Thanks again for your diagnosis and testing, -max
That's awesome, Max, thanks a lot! All tests pass and I can go on experimenting with other form interactions. Stay tuned!