开发者

Selenium ".check" Function Not Recognized

开发者 https://www.devze.com 2023-03-18 03:15 出处:网络
I have created an object using Selenium: driver = Selenium::WebDriver.for :firefox, :profile => profile

I have created an object using Selenium:

driver = Selenium::WebDriver.for :firefox, :profile => profile

I am attempting to make use of the "check" function for a radio button like so:

driver.find_element(:name => "SomeName").check

However, this comes up with an error:

in `<main>': undefined method `check' for #<Selenium::WebDriver::Element:0x35c75e8> 

Is there another way to select radio buttons in Selenium with Ruby that I am just not seeing anywhere?

Thanks.

EDIT:

Using the find_element.click function does not work either. For instance:

    <td valign="middle"><input type="radio" NAME="TESTNAME" VALUE="TESTVALUE1"></td>
    <td valign="middle"><input type="radio" NAME="TESTNAME" VALUE="TESTVALUE2"></td>
    <td valign="middle"><input type="radio" NAME="TESTNAME" VALUE="TESTVALUE3" ></td>

Performing:

driver.find_开发者_开发技巧element(:name => "TESTNAME", :value => "TESTVALUE3" ).click

Does not do anything. Any feedback on why this is case would be most appreciated.


Use Element#click. The API docs for the Selenium::WebDriver::Element class can be found here.

0

精彩评论

暂无评论...
验证码 换一张
取 消