surfer190 surfer190 - 1 year ago 108
HTML Question

WWW::Mechanize::Firefox How do you extract the text within HTML element tags?

Good Day,

How do you print the text of an

tag with

I have tried:

print $_->text, '/n' for $mech->selector('td.dataCell');

print $_->text(), '/n' for $mech->selector('td.dataCell');

print $_->{text}, '/n' for $mech->selector('td.dataCell');

print $_->content, '/n' for $mech->selector('td.dataCell');

Remember I do not want
, but that does work btw.

print $_->{text}, '/n' for $mech->selector('td.dataCell');

The above line does work, but output is just multiple

Answer Source

The only solution I have is to use:

my $element = $mech->selector('td.dataCell');

my $string = $element->{innerHTML};

And then formatting the html within each dataCell

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download