Hello Chris,
Oh, that looks interesting! I already have a different workaround, but
your workaround looks much cleaner!
I expect to release a new version with one of the two fixes in the next
24 hours!
Thanks for reporting and even fixing this,
-max
On 15.11.19 17:17, Denley, Chris via RT wrote:
Show quoted text> Queue: WWW-Mechanize-Chrome
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=131000 >
>
> I think I found a much cleaner workaround which may be of use to you, which queries the runtime property through Chrome::DevToolsProtocol.
>
> use Log::Log4perl qw(:easy);
> use WWW::Mechanize::Chrome;
>
> Log::Log4perl->easy_init($ERROR); # Set priority of root logger to ERROR
> my $mech = WWW::Mechanize::Chrome->new();
> $mech->get('
https://metacpan.org/pod/WWW::Mechanize::Chrome::Node');
> my $node = $mech->xpath('/html/body/div[1]/div[2]/div/div/div[1]/span[1]/a',single=>1);
> print $node->get_text()."\n";
> print $node->get_attribute('innerText')."\n";
> my $ret = $mech->target->send_message('Runtime.getProperties',objectId=>$node->{'objectId'},ownProperties=>JSON::false)->get()->{'result'};
> my %props = map {$$_{'name'} => $$_{'value'}{'value'}} @$ret;
> print $props{'innerText'}."\n";
>
> -----Original Message-----
> From: Bugs in WWW-Mechanize-Chrome via RT <bug-WWW-Mechanize-Chrome@rt.cpan.org>
> Sent: Thursday, November 14, 2019 5:16 PM
> To: Denley, Chris <Chris.Denley@experian.com>
> Subject: [rt.cpan.org #131000] AutoReply: get_text and get_attribute('innerText') return html
>
>
> Greetings,
>
> This message has been automatically generated in response to the creation of a trouble ticket regarding:
> "get_text and get_attribute('innerText') return html", a summary of which appears below.
>
> There is no need to reply to this message right now. Your ticket has been assigned an ID of [rt.cpan.org #131000]. Your ticket is accessible on the web at:
>
>
https://rt.cpan.org/Ticket/Display.html?id=131000
>
> Please include the string:
>
> [rt.cpan.org #131000]
>
> in the subject line of all future correspondence about this issue. To do so, you may reply to this message.
>
> Thank you,
> bug-WWW-Mechanize-Chrome@rt.cpan.org
>
> -------------------------------------------------------------------------
> use Log::Log4perl qw(:easy);
> use WWW::Mechanize::Chrome;
> use Data::Dumper;
> Log::Log4perl->easy_init($ERROR); # Set priority of root logger to ERROR my $mech = WWW::Mechanize::Chrome->new(); $mech->get('
https://metacpan.org/pod/WWW::Mechanize::Chrome::Node');
> my $node = $mech->xpath('/html/body/div[1]/div[2]/div/div/div[1]/span[1]/a',single=>1);
> print $node->get_text()."\n";
> print $node->get_attribute('innerText')."\n";
> my ($val,$type) = $mech->eval("document.evaluate('/html/body/div[1]/div[2]/div/div/div[1]/span[1]/a', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerText");
> print "What I expect: $val\n";
>
> <span itemprop="name">Max Maischein</span> <span itemprop="name">Max Maischein</span> What I expect: Max Maischein
>