RE: is it possible to get logo of any website using single script through selenium WebDriver.

I have 10 different website list and i want to get logo of these website using single script.
I am trying this script:-


List<WebElement> images = driver.findElements(By.cssSelector(“a>img”));

for(WebElement image : images){
String s = image.getAttribute(“src”);
}else if(s.endsWith(“logo.png”)){

but problem is there every site give different logo name.

So please help me to resolve problem…..

Add Comment
2 Answers

It is very difficult to say that an image is logo or not.

But u can study some sample data of 20 websites if u find something in common.

Also you can use some more broader search like this.
if(s.contains(“logo.jpg”)){ // TO DO code}

If u find something against resolution of image like height or width u can use below code and u can reject downloading image below and above certain height.


Supporter Answered on April 3, 2015.

Thanks Amit

but size vary in different-2 websites.

And throw “contaions” i found some sites logo not every site logo.

if you have another solution please help me……

on April 5, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.