我正在使用rspec
的硒和spec
文件中的硒:
wait.until { driver.find_element(:id => "data_source_type_name") }
RuleDesc = driver.find_element(:id, "data_source_type_name")
RuleDesc.send_keys "Mobility"
并在html中我有:
<div class="col-sm-9">
<input class="form-control" type="text" id="data_source_type_name" name="data_source_type[name]" required="">
</div>
实际上是在Bootstrap模式下(即仅在单击按钮后才可见)我模拟了点击。它显示了具有该特定div的模态,但我得到以下错误:
[remote server] file:///tmp/webdriver-profile20150119-6088-50uggo/extensions/fxdriver@googlecode.com/components/command-processor.js:8991:in `fxdriver.preconditions.visible': Element is not currently visible and so may not be interacted with (Selenium::WebDriver::Error::ElementNotVisibleError)
编辑:当我打印放置RuleDesc.displayed
时?它返回false但在webdriver中显示它。
答案 0 :(得分:0)
我做了一些自定义,在规范中我改变了包含Bootstrap Modal的css来显示:block;在访问该容器中的元素之前,使用javascript(没有通过单击按钮触发,为什么?不知道,但它正在显示。) Tada,然后每个选择器css,Xpath或ID都像奶油一样光滑。