如何爲iframe內容編寫rspec測試?我的Iframe看起來像針對iframe內容的Rspec測試
<iframe src="/any url" name="Original">
...
<div>test </div>
</iframe>
iframe之間的任何內容,我想爲該內容寫rspec測試用例。我能怎麼做 ?
我該如何檢查「test」是否在使用rspec的iframe中?我下面寫,但沒有通過
page.should have_content("test")
錯誤,如
Failure/Error: page.should have_content("test")
expected there to be content "test" in "Customize ....
我用的水豚 - 1.1.2和RSpec - 2.11.0和軌道3.2.8
根據[這個答案](http://stackoverflow.com/questions/6890364/capybarawebkit-unable-to-find-iframe-or-its-content)你需要等待iframe加載。如果你在測試'have_content'之前睡了幾秒鐘,會發生什麼? –
@shioyama - 'should have_content'已經等待(默認2秒)。 – skalee
@skalee哦,不知道。有趣。 –