$href = $element->getAttribute('href'); code example
Example 1: get href attribute javascript
document.getElementById("link")[0].getAttribute("href");
Example 2: get attribute href
document.find_element_by_xpath("//example").getAttribute('href')