在浏览器中选择了watir select_list项,但脚本挂起

时间:2014-10-23 10:11:34

标签: firefox watir watir-webdriver

我正在尝试从下拉框中选择一个项目。 HTML代码是:

<select id="selectRight" class="select-box-right" style="width: 40%; background-color: rgb(145, 195, 60);">
<option value="select">Select Your Option</option>
<option value="726766393"> A </option>
<option value="726766365">B</option>
<option value="726766445">C </option>
<option value="726766425">D</option>
</select>

在我使用其中任何一个的脚本中,我可以选择

#$browser.select_list(:id, "selectRight").select("A")
$browser.select_list(:id, "selectRight").select_value("726766393")
#$browser.select_list(:id, "selectRight").option(:value => "726766393").select

但脚本挂起,稍后我收到此错误

    D:/Ruby200/lib/ruby/2.0.0/net/protocol.rb:158:in `rescue in rbuf_fill': Net::ReadTimeout (Net::ReadTimeout)
        from D:/Ruby200/lib/ruby/2.0.0/net/protocol.rb:152:in `rbuf_fill'
        from D:/Ruby200/lib/ruby/2.0.0/net/protocol.rb:134:in `readuntil'
        from D:/Ruby200/lib/ruby/2.0.0/net/protocol.rb:144:in `readline'
        from D:/Ruby200/lib/ruby/2.0.0/net/http/response.rb:39:in `read_status_line'
        from D:/Ruby200/lib/ruby/2.0.0/net/http/response.rb:28:in `read_new'
        from D:/Ruby200/lib/ruby/2.0.0/net/http.rb:1405:in `block in transport_request'
        from D:/Ruby200/lib/ruby/2.0.0/net/http.rb:1402:in `catch'
        from D:/Ruby200/lib/ruby/2.0.0/net/http.rb:1402:in `transport_request'
        from D:/Ruby200/lib/ruby/2.0.0/net/http.rb:1375:in `request'
        from D:/Ruby200/lib/ruby/2.0.0/net/http.rb:1368:in `block in request'
        from D:/Ruby200/lib/ruby/2.0.0/net/http.rb:851:in `start'
        from D:/Ruby200/lib/ruby/2.0.0/net/http.rb:1366:in `request'
        from D:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for'
        from D:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/remote/http/default.rb:39:in `request'
        from D:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
        from D:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/remote/bridge.rb:638:in `raw_execute'
        from D:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/remote/bridge.rb:616:in `execute'
        from D:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/remote/bridge.rb:373:in `clickElement'
        from D:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/common/element.rb:54:in `click'
        from D:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/select.rb:155:in `select_by_string'`enter code here`
        from D:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/select.rb:131:in `select_by'
        from D:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/select.rb:78:in `select_value'

我们将不胜感激。 谢谢

0 个答案:

没有答案