Skip to content
CodeKruPro

Mouse Hover

55/70

Mouse Hover

locator.hover() moves the mouse over an element, triggering hover effects.

To read the computed background color (same pattern as the CSS-property lesson), use locator.evaluate(el => getComputedStyle(el).backgroundColor).

On the Buttons page, #colorChangeOnHover changes color when hovered.

Task:

  1. Navigate to https://testkru.com/Elements/Buttons
  2. Get the background color of #colorChangeOnHover before hover
  3. Hover over the button
  4. Get the background color after hover
  5. Print whether the color changed

Expected output:

Color changed: true