Am doing automation tesing using selenium, i need help in regarding how to select radio button.If possible help me with selenium java code.
Also, we can select Radio buttons by using the click() method. Selenium also offers validation methods like isSelected(), isEnabled() and isDisplayed(). We can use these methods before performing any operation to make sure radio buttons are in the correct state.
Assuming you have selenium set up its just:
selenium.click('radio button locator');
You may want to look at the selenium javadoc http://release.seleniumhq.org/selenium-remote-control/0.9.2/doc/java/com/thoughtworks/selenium/Selenium.html
click > xpath=(//input[@type='checkbox'])[position()=1]
click > xpath=(//input[@type='checkbox'])[position()=2]
click > xpath=(//input[@type='checkbox'])[position()=3]
click > xpath=(//input[@type='checkbox'])[position()=4]
etc ... use this commands to select random and any radio button
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With