1
votes

Wondering whether any Robot Framework Selenium2 rock star can help me figure out how to select this radio button:

<input type="radio"
id="CLIENTINFO.pIHaveDL_RAD-1.widget_2C56E5B6AA7C8538090416DEE7DE5A73000"
class="radiobutton webform-aria" aria-invalid="false" aria-required="true"
title="" value="on" style=" position:relative; left:-4px; top:-4px;
overflow:visible;" checked="true">

The RF Selenium2Library "Select Radio Button" keyword only allows me to provide a "group name" as locator. I have been successful using that on other radio buttons that actually have a group name in the markup. The radio button above doesn't have one.

I had considered trying the Selenium2 "Click Element" keyword and using Id as a locator, but the Id (in the markup above) is dynamic (i.e. different with every login), and I don't think RF can do partial Id can it? (edit: I just figured out that it does support this. I've used partial Id inside xpath)

The only other option I could think of is to use the "Execute JavaScript" keyword with document.QuerySelector() and a partial Id... but I'm not very good with JavaScript so I'm not confident that there is a click method that will work well cross-browser.

I'd appreciate any insight here.

1
Actually I just figured out that this works: Click Element xpath=//*[contains(@id, 'CLIENTINFO.pIHaveDL_RAD-1.widget')] I'll leave this open for a day to see whether anyone has a better solution.octechnologist
Glad you could find the resolution for your self and be rock star :)Rao

1 Answers

1
votes

Actually I just figured out that this works: Click Element xpath=//*[contains(@id, 'CLIENTINFO.pIHaveDL_RAD-1.widget')]