What is the problem with this javascript code? The function always returns error.
<!-- IMAGEM -->
<img class="coverPhotoImg photo img" src="ABC.JPG" alt="Foto 1">
<!-- IDENTIFICAÇÃO --->
<span class="hidden_elem enableFriendListFlyout outgoingButton" data-profileid="2015">Protocolo enviado.</span>
<script type="text/javascript">
//PELA LOGICA DEVERIA RETORNAR ABC.JPG
window.alert(document.getElementsByClassName('coverPhotoImg photo img').getAttribute('src'));
//PELA LOGICA DEVERIA RETORNAR 2015
window.alert(document.getElementsByClassName('hidden_elem enableFriendListFlyout outgoingButton').getAttribute('data-profileid'));
</script>