Use querySelector to target the img directly:
document.querySelector('#MyCssId img').src = 'myimage.png';
document.querySelector('#MyCssId img').srcset = ''; //This is needed if Elementor is applying the srcset= parameter
//If you want to apply a link (needs to already have a href):
document.querySelector('#MyCssId a').href = imgUrl;
Why document.getElementById(‘MyCssId’).src doesn’t work
As for .text, when you apply an ID to an Elementor widget, it is often applied a level up from the actual displayed image
If you use this on the ID:
document.getElementById('MyCssId').src = 'https://somedomain.com/myimage.png';
You won’t update it.
