I have a react component that uses the picture element. I would like test the image URL with a variety of viewports. On the actual implementation I can use the attribute "currentSrc" to retrieve the current image. However, when I assert "element.currentSrc" the value is always "". I assume this is because the image is not loaded therefore currentSrc has not been set. What is the approach to get the "currentSrc". Here is the picture element
2
Answers
The thread below explains why we cannot get the currentSrc. My mental map of how the library works was incorrect.
I think you need to add alt in the image tag. Then find the src with accessing alt. The code is like this :
});