I have two radio buttons YES and NO, the step on the feature file can pass argument to the method, both radio buttons has the same name so I want to click on the radio button by finding its name and value for example:

def licenceStatus(licenceS)
licence = @driver.find_element(name:"licence_status", value:licenceS).click

The above method works in Watir but not Selenium how do I get this to work?

  • The step on the feature file can pass argument like "Yes" or "No" to the method. Jun 21, 2017 at 11:08

2 Answers 2


If you familiar with css you can use css selector format


Try the following xpath with ruby

browser.find_element(:xpath => "//*[@name='licence_status' and @value='licenceS']").click()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.