使用 Ruby 和 Watir 设置单选按钮 [英] Setting Radio button using Ruby and Watir

查看:29
本文介绍了使用 Ruby 和 Watir 设置单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的,我遇到了一段代码问题.我知道如何设置单选按钮,我可以在大多数网站上进行设置.但是当尝试设置下面这段代码给出的值时,我无法让它工作.我尝试过使用标签等等待"、父设置"并进行各种搜索.任何人都可以指出我正确的方向.

<ol><li><span class="radio" style="background-position: 0px 0px;"></span><input class="styled" type="radio" value="1" name="clocksource"></input><label class="dialogRT">内部的<li><span class="radio" style="background-position: 0px 0px;"></span><input class="styled" type="radio" value="3" name="clocksource"></input><label class="dialogRT">外部 AES50<li><span class="radio" style="background-position: 0px -50px;"></span><input class="styled" type="radio" checked="checked" value="2" name="clocksource"></input><label class="dialogRT">外蛇</ol>

我收到此错误:

[远程服务器] file:///var/folders/81/j_87g_h12_x7bkl2w58zwqr00000gn/T/webdriver-profile20131024-1211-10eh16l/extensions/fxdriver@googlecode.com/process_components:in`fxdriver.preconditions.visible':元素当前不可见,因此可能无法与之交互

谢谢

最大值

解决方案

我怀疑您有时间问题.试试这个:

Watir::Wait.until { @browser.element.visible?, thing }

Right i am having issues with a section of code. I know how to set radio buttons i can do it on most websites. But when trying to set a value given by this code below i cannot make it work. I have tried "waiting until", "parent setting" using the label ect and searched through all sorts. Could any one point me in the right direction.

<div class="CheckBoxContainer">

<ol>
    <li>
        <span class="radio" style="background-position: 0px 0px;"></span>
        <input class="styled" type="radio" value="1" name="clocksource"></input>
        <label class="dialogRT">

            Internal

        </label>
    </li>
    <li>
        <span class="radio" style="background-position: 0px 0px;"></span>
        <input class="styled" type="radio" value="3" name="clocksource"></input>
        <label class="dialogRT">

            External AES50

        </label>
    </li>
    <li>
        <span class="radio" style="background-position: 0px -50px;"></span>
        <input class="styled" type="radio" checked="checked" value="2"       name="clocksource"></input>
        <label class="dialogRT">

            External Snake

        </label>
    </li>
</ol>

I get this error :

[remote server] file:///var/folders/81/j_87g_h12_x7bkl2w58zwqr00000gn/T/webdriver-profile20131024-1211-10eh16l/extensions/fxdriver@googlecode.com/components/command_processor.js:8210:in `fxdriver.preconditions.visible': Element is not currently visible and so may not be interacted with 

Thanks

Maximillion

解决方案

I suspect you have a timing issue. Try this:

Watir::Wait.until { @browser.element.visible?, thing  }

这篇关于使用 Ruby 和 Watir 设置单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆