18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Mouse over Menu item and test its color changes to "Blue"

dashboarddashboard Members
edited October 2013 in Sahi - Open Source
Hi

I want to test whether the colour of the Menu Item changes from X to Y when we mouse over that Menu item.
Can you please let me know how we can test this.

Regards
Uday

Answers

  • Hi Uday,
    I made a sample script to test your problem out. In the following script, my div is having red background color which changes to green on mouse over. You can use a script similar to the script mentioned below:
    _assertEqual("red", _div("<your_div_id>").style.backgroundColor)
    _mouseOver(_div("<your_div_id>"))
    _assertEqual("green", _div("<your_div_id>").style.backgroundColor)
    --Stopped Playback: SUCCESS--
    

    Here, i have performed color change on a div. However, you can use the above code for other type of elements as well.
    Please let me know if it works for you.

    Regards.
  • Hi Akash

    Thanks a lot for taking efforts to help me.The code is fine but instead of background color I have to check for text color. Please let me know if you can help me.

    Regards
    Uday
  • _assertEqual("", _div("SupportMenu").style.color);
    _mouseOver(_div("SupportMenu"));
    _assertEqual("", _div("SupportMenu").style.color);
    --Stopped Playback: SUCCESS--


    If I dont mention the colour the script is passing as above
    If I mention the colour the script is failing as below.


    _assertEqual("red", _div("SupportMenu").style.color);
    _mouseOver(_div("SupportMenu"));
    _assertEqual("blue", _div("SupportMenu").style.color);
    --Stopped Playback: FAILURE--

    Please give your inuts.

    Regards
    Uday
Sign In or Register to comment.