16

Until now I just did like:

val radioButton4: WebElement = driver.findElement(By.id("FieldsubCode2"))

radioButton4.click

but now I want to find element by value, this value:

enter image description here

So I want to go:

val radioButton4: WebElement = driver.findElement(By.value("3.2"))


radioButton4.click

How can I do that?

4 Answers 4

14

If you want to find only by value then use,

driver.findElement(By.xpath("//input[@value='3.2']"));
Sign up to request clarification or add additional context in comments.

Comments

10
driver.findElement(By.xpath("//input[@name='buttonName' and @value='3.2']"));

Comments

5
driver.FindElement(By.cssSelector(input[type='radio'][value='3.2']));

Comments

4

In python, it's

driver.find_element_by_xpath("//input[@name='buttonName' and @value='3.2']")

1 Comment

This does not work in the latest version and I have not found anything in the documentation that explains how to use it. Any suggestions?

Your Answer

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.