开发者

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

开发者 https://www.devze.com 2022-12-19 21:16 出处:网络
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 loa

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

精彩评论

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

关注公众号