I'm so new in Selenium need help. I'm trying to get all image src in the page to check if there is not loaded image in the page. How can I check the images src? Can I check with "null"? Here is my code and of course there are mistakes. Also I checked some links for this issue, but didn't solve my problems for example this link: Selenium: How do I get the src of an image?
Do you know docs for the selenium selectors for learning?
List<String>srcLinks = null;
List<WebElement> srcClass=driver.findElements(By.tagName("img"));
for (WebElement src : srcClass) {
srcLinks.add(src.getAttribute("src"));
System.out.println(src);
}
for(int i=0;i<srcLinks.size();i++) {
if(srcLinks.get(i).contains(null)) {
System.out.println("null img src found");
}
}
Also here is the HTML code for src:
<img class="bigBoutiqueImage lazy-load-trigger loaded"
**src="https://img-trendyol.mncdn.com//Assets/ProductImages/OA/CampaignVisual/OriginalBoutiqueImages/12640/4pu3yjc3_11_new.jpg"**
data-original="https://img-trendyol.mncdn.com//Assets/ProductImages/OA/CampaignVisual/OriginalBoutiqueImages/12640/4pu3yjc3_11_new.jpg"
title="Twigy - Yılbaşı Özel"
onerror="this.src='/Resources/images/bigBoutiquePlaceHolder.png'"
alt="Twigy - Yılbaşı Özel">