The links for these files
<a class="txt" href="file.txt"> Text File </a>
can be obtained using the WMC instance by doing something like this
my @links = $mech->find_all_links( text_contains => 'some description
+etc... ' );
my @urls = map { $_->[0] } @links;
In the case of WWW::Mechanize (WM) you can simply download the files using this code
for my $foo (@urls)
{
my $filename = '/path/'.$foo;
$mech->get($foo, ':content_file'=>$filename);
}
Unfortunately, this function does not work with WWW::Mechanize::Chrome (WMC).
I hope the Author of WMC can shed some light on this or provide a patch.
Thank you.
|