Question: I have got null when I search for the src attribute of an image. Please resolve the element identification for the image. 

My Selenium WebDriver code to identify the image src using WebDriver:

```
@FindBy(xpath = "//div[contains(@class, 'image-section')]/img")
private WebElement getimage;

public String getImageSrc(){
    return  getimage.getAttribute("src");
}

```

I have the following exception: 

```
org.openqa.selenium.NoSuchElementException: no such element:

```

Answer: 
Simply use [**`Array#find()`** method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) like this:

```
function person(name) {
  return people.find(function(p) {
    return p.name == name;
  });
}
console.log(person("Samantha"));

```

**Demo:**

```js
var people = [{
    name: "Sue",
    surname: "Beckett",
    age: 50
  },
  {
    name: "Bill",
    surname: "Borough",
    age: 44
  },
  {
    name: "Janet",
    surname: "Jupp",
    age: 23
  },
  {
    name: "Peter",
    surname: "Pepper",
    age: 21
  },
  {
    name: "Samantha",
    surname: "Salad",
    age: 17
  }
];

function person(name) {
  return people.find(function(p) {
    return p.name == name;
  });
}
console.log(person("Samantha"));
console.log(Object.values(person("Samantha")));
```

**Note:**

* Make sure you pass the name as a `string` when you call your method, passing just `sue` without `""` will assume you have a variable called `sue`.
* Note that you can use `Object.values()` to show only the values of
the object properties, instead of the whole object.

Simply write :

```
console.log(Object.values(person("Samantha")));

```
You could filter the array by checking the lower case value of `name` property and `name` variable.

```js
function person(name) {
    people
        .filter(o => o.name.toLowerCase() === name.toLowerCase())
        .forEach(({ name, surname, age}) => {
            console.log('name:', name);
            console.log('suname:', surname);
            console.log('age:', age);
        });
}

var people = [{ name: "Sue", surname: "Beckett", age: 50 }, { name: "Bill", surname: "Borough", age: 44 }, { name: "Janet", surname: "Jupp", age: 23 }, { name: "Peter", surname: "Pepper", age: 21 }, { name: "Samantha", surname: "Salad", age: 17 }];

person('sue');
```