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.

Unable to select radio buttons.

nagarnagar Members
edited November -1 in Sahi - Open Source
Hi All,

In my application, I have two drop down lists containing multiple radio buttons with their names. In these two drop down lists, few of the radio button names are similar and few are different. Like, in list 1, suppose I have a radio button with name "abc". Again in List 2 also, I have a radio button with same name, i.e. "abc".

I want to write a common code for handling radio buttons in these lists. My code line is "_click(_radio(0,_near(_cell("abc"))));"

My problem is, when I try to select radio button "abc", in List 2, sahi accessor becomes "_cell("abc[2])" , as "abc" exists in List 1 also.


Kindly help me in this so that I can write a common code line for both lists.

OS: Win XP
Browser: FF3.6
Sahi Build: 2011-07-19 (V3.5)

Comments

  • hi nagar

    I think you will have to use 2 lines of code, clicking in both lists at the same time isn't possible IMHO
    you could use _click(_radio(0,_near(_cell("/abc/")), _in(LIST1)) and _click(_radio(0,_near(_cell("/abc/")), _in(LIST2))

    regards
    Wormi
  • Hi Wormi,

    Thanks for your quick response.

    I am not clicking on both the lists at the same time. I am doing this one by one. But the main problem is if any button name exists within both lists, say "abc" then for List 2, it becomes "abc[2]".

    That's why code _click(_radio(0,_near(_cell("abc")) does not work for List 2. And I don't want to mention this index no. [2] in my code.

    Is there any solution for this?


    Regards,
    nagar.
  • Hi nagar,

    You can use:

    _click(_radio(0,_near(_cell("/abc/")))); for list 2.

    Let me know if you face any problem.

    Regards
    Sumitra
  • Thanks Sumitra & Wormi,

    Your solution has solved my problem. Thanks a lot!


    Regards,
    nagar
This discussion has been closed.