开发者

How can I get the frame source with Perl's WWW::Mechanize?

Using WWW::Mechanize::Firefox, I can get the source of the page I visited. However, if the page contains a frame, I get the frame tag and开发者_开发知识库 not the actual source of the page that is loaded. Mechanize::Frames seems to be what I am looking for. Is there a way to use them together?


That's probably because you're not loading the frame contents.

$mech->follow_link(tag => "frame"); # open first frame in document
my $src = $mech->content;


To get at the frame HTML source, just get that frame through ->selector() or ->xpath() and then use $frame->{innerHTML}.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜