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?

alecxe
11.4k11 gold badges52 silver badges107 bronze badges
asked Jun 21, 2017 at 11:05
1
  • The step on the feature file can pass argument like "Yes" or "No" to the method. Commented Jun 21, 2017 at 11:08

2 Answers 2

1

If you familiar with css you can use css selector format

driver.find_element(:css,"[name='radioBtn'][value='1']")
answered Jul 21, 2017 at 21:00
0

Try the following xpath with ruby

browser.find_element(:xpath => "//*[@name='licence_status' and @value='licenceS']").click()
answered Jun 21, 2017 at 17:56
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.