如何将网页中属于 Chrome 下拉菜单的特定部分添加为书签?我尝试过将 Chrome 扩展程序链接至 fragment。它不起作用。这是一个网站示例,尝试在单击加油站后将加油站价格添加为书签。
https://www.costco.com/warehouse-locations/w-jacksonville-fl-1294.html
感谢您的帮助!
答案1
你不能。
该页面设计为以折叠状态加载可折叠面板。您需要单击它们才能展开它们。加载时信息确实存在于页面中,只是隐藏了。如果您使用工具解析 HTML,理论上您可以根据 html 代码提取所需的值。
例子
<span class="gas-type">Regular</span><br>
<span class="h3-style-guide">$2.91<sup>9</sup></span>
和
<span class="gas-type">Premium</span><br>
<span class="h3-style-guide">$3.31<sup>9</sup></span>
摘自
<div id="service-collapse-1" class="panel-collapse collapse in" aria-labelledby="service-header-1" aria-expanded="true" style="">
<div class="panel-body">
<div class="col-xs-12 gas-title">
<span class="h5-style-guide">Gas Hours</span>
</div>
<div class="col-lg-12 working-hours-section">
<div class="col-xs-3 col-xl-2 padding-left-0">
<time itemprop="openingHours" datetime="Mon-Fri. ">Mon-Fri. </time>
</div>
<div class="col-xs-9 col-xl-10 padding-left-0">
<time itemprop="openingHours" datetime="6:00am - 9:00pm">6:00am - 9:00pm</time>
</div>
</div>
<div class="col-lg-12 working-hours-section">
<div class="col-xs-3 col-xl-2 padding-left-0">
<time itemprop="openingHours" datetime="Sat. ">Sat. </time>
</div>
<div class="col-xs-9 col-xl-10 padding-left-0">
<time itemprop="openingHours" datetime="7:00am - 7:00pm">7:00am - 7:00pm</time>
</div>
</div>
<div class="col-lg-12 working-hours-section">
<div class="col-xs-3 col-xl-2 padding-left-0">
<time itemprop="openingHours" datetime="Sun. ">Sun. </time>
</div>
<div class="col-xs-9 col-xl-10 padding-left-0">
<time itemprop="openingHours" datetime="7:00am - 7:00pm">7:00am - 7:00pm</time>
</div>
</div>
<div class="row col-xl-8 gas-price-section">
<div class="col-xs-3">
<span class="gas-type">Regular</span><br>
<span class="h3-style-guide">$2.91<sup>9</sup></span>
</div>
<div class="col-xs-3">
<span class="gas-type">Premium</span><br>
<span class="h3-style-guide">$3.31<sup>9</sup></span>
</div>
</div>
<div class="col-xl-8 diclaimer-section">
<p class="disclaimer-text-font" automation-id="gasPriceDisclaimerLabel">
Prices shown here are updated frequently, but may not reflect the
price at the pump at the time of purchase. All sales will be made
at the price posted on the pumps at each Costco location at the
time of purchase.</p>
</div>
</div>
</div>