如何使用 Perl 的 WWW::Mechanize 获取框架源?

发布于 2024-08-20 11:09:57 字数 126 浏览 4 评论 0原文

使用 WWW::Mechanize::Firefox,我可以获得我访问的页面的源代码。但是,如果页面包含框架,我将获得框架标记,而不是加载的页面的实际源。 Mechanize::Frames 似乎就是我正在寻找的。有没有办法一起使用它们?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

焚却相思 2024-08-27 11:09:57

这可能是因为您没有加载框架内容。

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

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;
节枝 2024-08-27 11:09:57

要获取框架 HTML 源代码,只需通过 ->selector()->xpath() 获取该框架,然后使用 $frame-> ;{innerHTML}

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文