

























2. selenium-on-rails 清理cache
并没有提供这个功能,但是在测试开始时确实需要,方案在Align书的"基于时间的缓存失效策略"里描述了,就是删除文件夹tmp/cache
这里直接清理tmp文件夹
# selenium-on-rails/lib/selenium-on-rails/paths.rb
def tmp_path
File.expand_path File.join(RAILS_ROOT,'tmp')
end

# selenium-on-rails/lib/controllers/selenium-controller.rb

def tmp_clear ## tachikoma add
FileUtils.rm_r Dir.glob(tmp_path+"/*")
RAILS_DEFAULT_LOGGER.info("Tmp directory fully sweeped.")
render :file => view_path('tmp_clear.rhtml')
end

另外做一个tmp_clear.rhtml就可以了
在测试文件中调用
open '/selenium/tmp_clear"
就OK
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。