我想用Perl来点击一个按钮。我得到HTML内容,然后找到点击按钮。 但是当我检查HTML内容时,“input type = hidden”。如何点击按钮(输入类型=隐藏)通过Perl?
HTML内容:
<div class="content freepts_cont">
<input type="hidden" id="network" value="5"/>
<div class="like_notification"></div>
Firebug的内容:
<div class="content freepts_cont">
<input id="network" type="hidden" value="5">
<div class="like_notification"></div>
<div id="site-links-list">
<center>
<div id="L_c3cbf051418f1ec690c445ad843144" class="yt-video-content" style="width: 520px;">
<div class="likedPagesSingle" style="width:400px;border:1px solid #E8E8E8;padding-top:15px; min-height:250px;">
<center>
<center>
<div class="fb_page_title">
<div style="width:100px; height:100px; overflow:hidden;">
<a style="display:block; width:100px; heigt:100px; overflow:hidden;" href="#">
<img style="width:100%; height:auto;" title="Night Thriller" alt="Night Thriller" src="/images/layout/youtube_page_view.png">
</a>
</div>
<a class="single_like_button btn3-wrap" onclick="openFbLWin(843144, 'JTJGMiUzQSVFMyVEQyUxNSU5MSU4NCUxMSU3RiVFNyU4OCUyM1clM0QyJUM3JUIwMw==');">
</center>
<div class="mtop10" style="margin-bottom:10px;">
<div class="mtop10" style="margin-bottom:10px;">
</div>
</div>
我想用Perl点击: <a class="single_like_button btn3-wrap" onclick="openFbLWin(843144, 'JTJGMiUzQSVFMyVEQyUxNSU5MSU4NCUxMSU3RiVFNyU4OCUyM1clM0QyJUM3JUIwMw==');">
如何?
您需要对JavaScript进行反向工程,然后用Perl重新实现,或者使用Selenium或PhantomJS等无头浏览器。 – Quentin 2014-11-01 19:31:07