Perform assertion while hovering on an element

Is there a way to assert a change in a selector based on mouse hover?

I have a catalog screen where item is displayed. Below the item there are different color options. Hovering on these options updates the main item image.

image

When I hover on another color, the “src” attribute of the main image updates.

img class=“item-result__image item-result__image–secondary” src=“https://www.somesite.com/product-images/20023/60/83/9/60839_pair_medium.jpg”>

I can perform mouseover on the other color, but while performing that action, is it possible to validate/assert the src tag change?

you can get the value of src attribute using

String src = WebUI.getAttribute(TestObject, "src")
assert src == "https://www.somesite.com/product-images/20023/60/83/9/60839_pair_medium.jpg"