I'm using PhantomJS to iterate through a web page and get certain values such as the amount of images for a product.
My problem is that the images do not seem to be appearing in the Pagesource and so I am not able to get them.
I think the images only appear if a script is run.
When I inspect the element of the page I can see the following:
<div class="pdp-images accessibility" tabindex="-1">
<img src="http://kingfisher.scene7.com/is/image/Kingfisher/8007842805253_01c?$PROMO_60_60$" alt="Indesit BIMDS23BIXS Electric Eye Level Double Oven: Image 1">
<img src="http://kingfisher.scene7.com/is/image/Kingfisher/8007842805253_07c?$PROMO_60_60$" alt="Indesit BIMDS23BIXS Electric Eye Level Double Oven: Image 2">
<img src="http://kingfisher.scene7.com/is/image/Kingfisher/8007842805253_02c?$PROMO_60_60$" alt="Indesit BIMDS23BIXS Electric Eye Level Double Oven: Image 3">
</div>
However, when I go to PhantomJSDriver and look at the Pagesource they do not exist.
instead there is the following:
<div class="pdp-viewer" style="position: relative;">
<script id="pdp-viewer" type="text/mustache"> Item <span id="pdp-viewer-counter-current">{{currItem}}</span> of <span id="pdp-viewer-counter-total">{{totalItems}}</span>
I then looked at the page source which has the following:
<div class="pdp-viewer">
<div class="media-player" data-s7-viewer="s7MixedMediaViewer"
data-asset="Kingfisher/8007842805253_01c;;advanced_image;,Kingfisher/8007842805253_07c;;advanced_image;,Kingfisher/8007842805253_02c;;advanced_image;" data-width="" data-height="">
<div class="pdp-viewer-counter"></div>
<div class="pdp-images accessibility" tabindex="-1">
<img src="http://kingfisher.scene7.com/is/image/Kingfisher/8007842805253_01c?$PROMO_60_60$" alt="Indesit BIMDS23BIXS Electric Eye Level Double Oven" />
<img src="http://kingfisher.scene7.com/is/image/Kingfisher/8007842805253_07c?$PROMO_60_60$" alt="Indesit BIMDS23BIXS Electric Eye Level Double Oven" />
<img src="http://kingfisher.scene7.com/is/image/Kingfisher/8007842805253_02c?$PROMO_60_60$" alt="Indesit BIMDS23BIXS Electric Eye Level Double Oven" />
</div>
</div>
<script id="pdp-viewer" type="text/mustache">
Item
<span id="pdp-viewer-counter-current">{{currItem}}</span>
of
<span id="pdp-viewer-counter-total">{{totalItems}}</span>
</script>
I am trying to pick up the images using:
result.ImagesCount = driver.FindElementsByCssSelector("pdp-images.accessibility img").Count;
but as they don't exist in the PhantomJS driver Pagesource this is not possible.
The page I am looking at is the following:
http://www.diy.com/departments/indesit-bimds23bixs-electric-eye-level-double-oven/250650_BQ.prd