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.

how to highlight a button in popup using java

lshankar_mcalshankar_mca Members
edited November -1 in Sahi - Open Source
Hi Narayan,

How to highlight a button inside a popup button using with the java api.

Below is the code

browser.popup("00000542").button("Search").click();

i want to hightlight the above button.

browser.execute("_sahi._highlight(_sahi._button('Search'));");
its not working

Please help me.

Regards,
Shankar L

Comments

  • Hi lshankar_mca,

    You can use:

    Browser popupPopWin = browser.popup("00000542");
    popupPopWin.execute("_sahi._highlight(_sahi._button(\"Search\"))");

    or

    browser.popup("00000542").execute("_sahi._highlight(_sahi._button(\"Search\"))");

    Let me know if this solves your issue.

    Regards
    Sumitra
  • lshankar_mcalshankar_mca Members
    edited November 2011
    Hi sumitra,

    Thanks for your quick help.

    I am using following method to highlight the elements in a pop up.

    browser.execute("_sahi._highlight(_sahi._popup('00000542')._sahi._button('Search'));");

    and its working fine for me, but now i don't want to hard code the pop up window name inside the execute method. so i am using regular expression for that and its not working.

    browser.execute("_sahi._highlight(_sahi._popup('/.*/')._sahi._button('Search'));");

    how to apply the regular expression for the popup name.


    Regards,
    Shankar L
  • Hi lshankar_mca,

    browser.execute("_sahi._highlight(_sahi._popup('/.*/')._sahi._button('Search'));"); // This will not work because the "00000542" will be stored on the parent window from where the popup was been launched.It wont understand if you mention the popup id in regular expression.
    You can use regular expression when the popup id's are changing.

    You will have to use it as below:

    browser.execute("_sahi._highlight(_sahi._popup('00000542')._sahi._button('Search'));");

    OR

    browser.popup("00000542").execute("_sahi._highlight(_sahi._button(\"Search\"))");

    Regards
    Sumitra
Sign In or Register to comment.