#!/usr/bin/perl use strict; use warnings; use Win32::IEAutomation; my $ie = Win32::IEAutomation->new( visible => 1 ); $ie->gotoURL("https://www.iryo.pref.tokushima.jp/iryou-kokai/MainMenu"); $ie->getButton('name:', 'submit_find')->Click; my $frame = $ie->getFrame('name:', 'search_low'); my @links = $frame->getAllLinks(); my @urls = map { $_->linkUrl } @links; foreach my $url (@urls) { next unless $url =~ m!^https://www\.iryo\.pref\.tokushima\.jp/iryou\-kokai/SimpleView\?kikan=(\d+)$!; $ie->gotoURL( $url ); $ie->getFrame('name:', 'sv_low' ); my $filename = "$1.html"; print "FILENAME: $filename\n"; open(F, "> $filename") or die $!; print F $ie->Content; close F; }