vds1
(Vishal)
December 12, 2017, 10:38am
1
Hello -
I have two radio button below and i need to check the option containing.
I can use click activity to perform this task but i wanted to try using Javascript (Inject JS activity ).
Please help me with the JS Code if the tag for clicking the “containing” radio button would be below
<INPUT type=radio value=containing name=selSearchField ></Input>
vvaidya
(Vinay Vaidya)
December 12, 2017, 9:19pm
2
YThis should work
Call below js file in injectjs activity
function check()
{
if(document.readyState === "complete")
{
document.getElementsByName("selSearchField").checked = true;
}
}
Or since it is a list try this ( did not test)
function check()
{
if(document.readyState === "complete")
{
document.getElementsByName("selSearchField")[1].checked = true;
}
}
2 Likes
vds1
(Vishal)
December 13, 2017, 1:05pm
3
Thanks Vinay. Your second option worked like a charm. Also why use [1] ? i wanted to learn how it works.
vvaidya
(Vinay Vaidya)
December 13, 2017, 2:20pm
4
The radio buttons in the radiobutton list are index based, since your “containing” is the second item so the index value is 1 (starts from 0)
1 Like
vds1
(Vishal)
February 27, 2018, 7:13am
5
Hello Vinay,
Thanks for all help so far. Just like how you used index, suppose there was a multi select list and i wanted to select two items, then how would i write the code ?
There is a issue with multi select activity in UiPath. It doesn’t work for me. Maybe i need to use Inject JS for my kinda issue ?
https://forum.uipath.com/t/select-multiple-items/