Question: Tried extracting the href from:

```
<a lang="en" class="new class" href="/abc/stack.com" 
tabindex="-1" data-type="itemTitles"><span><mark>Scott</mark>, CC042<br></span></a>

```

using `elems = driver.find_elements_by_css_selector(".new class [href]")` , but doesn't seem to work.

Also tried [Python Selenium - get href value](https://stackoverflow.com/questions/54862426/python-selenium-get-href-value), but it returned an empty list.

So I want to extract all the href elements of class = "new class" as mentioned above and append them in a list

Thanks!!

Answer: 
Use `.get_attribute('href')`.

`by_css_selector`:

```
elems = driver.find_elements_by_css_selector('.new.class')
for elem in elems:
    print(elem.get_attribute('href'))

```

Or `by_xpath`:

```
elems = driver.find_elements_by_xpath('//a[@class="new class"]')

```
Just change it to

```
elems = driver.find_elements_by_css_selector(".new.class[href]")

```

OR

```
elems = driver.find_elements_by_css_selector("[class='new class'][href]")

```