$browser.links.each do |link|
puts link.attribute_value("class")
if link.attribute_value("class")=='btn btn-success nextStep'
link.click
end
end
上面的代码打印了链接的所有类名(耶......)但是当它触发 btn btn-success nextStep 的点击事件时 - 它说元素不可见。如果我添加when_present.click
...超时。
Error:
btn btn-success nextStep
[remote server] file:///var/folders/3w/b7rcpqfj7kl3wtv56jt99yx00000gn/T/webdriver-profile20120924-3889-1erbmdf/extensions/fxdriver@googlecode.com/components/command_processor.js:5908:in `unknown': Element is not currently visible and so may not be interacted with (Selenium::WebDriver::Error::ElementNotVisibleError)
我试过了
$browser.link(:class,'nextStep').when_present.click
$browser.link(:class,'nextStep').click