我正在尝试查找包含“演示文稿”的HTML文档。
<!DOCTYPE html>
<html class="gr_dealers_partcanada_com" lang="en"> = $0
</html>
<head>...</head>
<body onload data-gr-c-s-loaded="true" class="fancybox-active"> = $0
<header class="no-print">...</header>
<div class="no-print">...</div>
<div style="clear:both"></div>
<div style="padding: lem;">...</div>
<br>
<br>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<div style="clear: both">...</div>
<footer class="no-print"></footer>
<!-- Google Tag Manager (noscript) -->
<noscript>...</noscript>
<!-- End Google Tag Manager (noscript) -->
<div class="fancybox-container fancybox-is-open fancybox-can-swipe" role="dialog" tabindex="-1" id="fancybox-container-3" style="transition-duration: 366ms;">
<div class="fancybox-bg"></div>
<div class="fancybox-inner">
<div class="fancybox-infobar">...</div>
<div class="fancybox-toolbar compensate-for-scrollbar">...</div>
<div class="fancybox-navigation">...</div>
<div class="fancybox-stage">
<div class="fancybox-slide fancybox-slide--iframe fancybox-slide--current fancybox-slide--complete" style="overflow: auto;">
::before
<div class="fancybox-content" style="width: 921.3333339691162px; max-width: 900px; max-height: 700px; padding: 1em; height: 126.13020896911621px;" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allowtransparency="true" src="/common/inventory_item_images.php?sku=1402-0264" vspace="0" webkitallowfullscreen>
#document
<!DOCTYPE html>
<html lang="en" class="fontawesome-i2svg-active fontawesome-i2svg-complete gr__dealers_partscanada_com">
<head>...</head>
<body onload data-gr-c-s-loaded="true">
<div class="container-fluid">...</div>
<div class="row">...</div>
<div class="row"></div>
<div class="col-12 col-md-4" style="font-size: 1.4em;">...</div>
<div class="col-12 col-md-8">
<div class="zoom" id="imageZoom" style="position: relative, overflow: hidden;">
<img alt="97-08 VN1500 CLSS GANGSTER RR FENDER" class="img-responsive img-rounded mx-auto d-block" height="500" id="imageZoomSource" src="/images/filestore/2/8/2/3/0_3b239de3b91c562/28230scr_9c23b47500062f0.jpg">
<img role="presentation" alt src="https://dealers.partscanada.com/images/filestore/2/8/2/3/0_3b239de3b91c562/28230scr_9c23b47500062f0.jpg" class="zoomImg" style="position: absolute; top: -35.34375px; left: -9.936655583424669px; opacity: 0; width: 832px; height: 800px; border: none; max-width: none; max-height: none;">
::after
</div>
</div>
</div>
</div>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<div style="clear: both;"></div>
<footer class="np-print"> </footer>
<!-- Google Tag Manager (noscript) -->
<noscript>...</noscript>
<!-- End Google Tag Manager (noscript) -->
</body>
</html>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
我已经尝试过此AppleScript代码:
tell application "Safari"
set keyword to "presentation"
set myWindow to current tab of first window
activate
set pageContent to do JavaScript ("window.document.documentElement.outerHTML") in myWindow
if pageContent contains keyword then
return "found it"
else
return "not found"
end if
end tell
但是我找不到想要的代码。
这是我要查找的代码:
<img class="img-responsive img-rounded mx-auto d-block" id="imageZoomSource" src="/images/filestore/2/8/2/3/0_3b239de3b91c562/28230scr_9c23b47500062f0.jpg" alt="97-08 VN1500 CLSS GANGSTER RR FENDER" height="500">
<img role="presentation" alt="" src="https://dealers.partscanada.com/images/filestore/2/8/2/3/0_3b239de3b91c562/28230scr_9c23b47500062f0.jpg" class="zoomImg" style="position: absolute; top: -375.34375px; left: -275.53469397254304px; opacity: 0; width: 832px; height: 800px; border: none; max-width: none; max-height: none;">
我想获取图像的源代码或获取可以找到代码的整个文档,并将其存储在变量中。