Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check a radio button with Selenium WebDriver?

I want to check this radio button, but I didn't know how. My HTML is:

<div class="appendContent">

    <div> id="contentContainer" class="grid_list_template">
        <div id="routeMonitorOptions"></div>
    </div>

    <input id="optionStopGrid" type="radio" name="gridSelector"/>
    <label for="optionStopGrid">Paradas</label>
</div>
like image 523
Sandy Maciel Avatar asked Nov 27 '25 05:11

Sandy Maciel


1 Answers

Please try this code to select the radiobutton-

driver.findElement(By.cssSelector("input[id='optionStopGrid']")).click();
like image 122
user3657330 Avatar answered Nov 29 '25 17:11

user3657330



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!