Using Selenium testing with Radio buttons

0
Hi I'm trying to implement Selenium-based automated testing on our system. However, I'm having a problem with Radio buttons. The group of all radio buttons have a consistent name each time, but the individual radio buttons' names change every time the page is loaded. How do I uniquely reference them to pick one? Hannes
asked
2 answers
1

I'm no expert on Selenium, but I would think you should target the radio button group by its name, and then the value by its "value" property instead of it's name?

 

So in the case below target the radio button widget by class: mx-name-radioButtons1, then the input by value: Started.

<div data-mendix-id="82_4" class="form-group mx-name-radioButtons1">
    <label class="control-label col-sm-4">Status</label>
    <div id="mxui_widget_RadioButtonGroup_0" data-mendix-id="82_9" class="col-sm-8" focusindex="0" widgetid="mxui_widget_RadioButtonGroup_0">
        <div>
            <label class="radio-inline"><input type="radio" name="1485451514926-30" value="_New">New</label>
            <label class="radio-inline"><input type="radio" name="1485451514926-30" value="Started">Started</label>
            <label class="radio-inline"><input type="radio" name="1485451514926-30" value="Complete">Complete</label>
        </div>
    </div>
</div>

 

answered
1

I tried something similar to that that didn't quite work, but in the end I did manage to find a solution in the Selenium plugin that automatically adapts the naming scheme to match Mendix's own as you use the IDE.

So thanks, I am sure there is some way to do things the way you did them, but since this works I'm sticking to it.

Out of interest, when I click the left-most button of the radio buttons, it basically calls the radio buttons, but when I pick the right button it does something... different. Basically, it clicks this:

//div[@id='mxui_widget_RadioButtonGroup_1']/div/label[2]

It works consistently, so I am not going to muck with it too hard.

answered