【问题标题】:Goutte click on anchor tag that executes javascriptGoutte点击执行javascript的锚标签
【发布时间】:2016-12-11 19:03:55
【问题描述】:

我对使用 php 爬虫有点陌生。我正在尝试使用 Goutte 下载通过单击“img”元素访问的 excel 文件,该元素由锚标记包围 - 它执行“onclick”事件以收集发布请求的标题和数据。这是我试图访问 excel 文件的网站上 html 的样子:

<div class="btncon">
<form method="post" id="export_selection" action="">
<input type="hidden" name="selected_for_export" id="selected_for_export">
<input type="hidden" name="selected_for_export_order" id="selected_for_export_order" value="desc">
<input type="hidden" name="selected_for_export_order_field" id="selected_for_export_order_field" value="_id_">
<input type="hidden" name="search_key" id="selected_for_export_search_key" value="">
</form>

<a onclick="return check_and_export();" href="javascript:void(0);"><img src="//assets.emailmeform.com/images/exportbtn.gif?RU1GLTAyLTI5" alt="Export"></a>
<a href="#"><img onclick="confirm_delete();return false;" src="//assets.emailmeform.com/images/deletebtn.gif?RU1GLTAyLTI5" alt=" "></a>
<!--
<button onclick="save_grid_preference();">Save Layout</button>
 -->
<form onsubmit="set_search();return false;" lpformnum="1">
    <div id="search_wraper">
    <a href="https://app.emailmeform.com/builder/forms/entries_search/3693462" target="_blank"><span title="Advanced Search">&nbsp;&nbsp;&nbsp;&nbsp;</span></a>
    <input type="text" id="search_bx" class="search" value="">
    </div>
    </form>
            </div>

我已经到了这个页面,现在我如何使用 Goutte 和/或 GuzzleHttp 在收到响应后点击“导出”图像并下载 excel 文件?

【问题讨论】:

标签: php symfony guzzle goutte


【解决方案1】:

你是对的,Goutte 是不可能的。

尝试改用Mink,它支持通过Selenium驱动执行JS。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-30
    • 1970-01-01
    • 1970-01-01
    • 2013-10-22
    • 2015-10-07
    • 1970-01-01
    相关资源
    最近更新 更多