1

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
end 

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. – user3341382 Jun 21 '17 at 11:08
1

If you familiar with css you can use css selector format

driver.find_element(:css,"[name='radioBtn'][value='1']")
0

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, privacy policy and cookie policy

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