From: Arihan Sinha Date: 2010-09-24T19:05:24+09:00 Subject: How to delete the browser cache through ruby Hi All, I am using the below code but it seems not working for IE. ( not sure). Could anyone please help me how to delete the cache . I also found the code in the below location but it seems very unclear which method I need to call etc. Can anyone please step wise tell me if I need to use the code from http://lazax.com/software/del_cache/del_cache.html http://lazax.com/software/del_cache/del_cache.html def delete_cache @window_os_flag = RUBY_PLATFORM.downcase.include?("mswin") #@mac_os_flag = RUBY_PLATFORM.downcase.include?("darwin") @browser_name = page.get_eval("navigator.userAgent") if @window_os_flag.to_s == "true" if @browser_name.to_s =~ /IE/ puts "Test is running in window platform with browser IE" puts Dir.glob('/Users/'+ENV['USERNAME']+'/AppData/Local/Microsoft/Windows/Temporary Internet Files/*') FileUtils.rm_r Dir.glob('/Users/'+ENV['USERNAME']+'/AppData/Local/Microsoft/Windows/Temporary Internet Files/*'),:force => true puts Dir.glob('/Users/'+ENV['USERNAME']+'/AppData/Local/Microsoft/Windows/Temporary Internet Files/*') end if @browser_name.to_s =~ /Chrome/ puts "Test is running in window platform with browser googlechrome" FileUtils.rm_r Dir.glob('/Users/'+ENV['USERNAME']+'/AppData/Local/Google/Chrome/User Data/Default/*'),:force => true end if @browser_name.to_s =~ /Firefox/ puts "Test is running in window platform with browser Firefox" FileUtils.rm_r Dir.glob('/Users/'+ENV['USERNAME']+'/AppData/Local/Mozilla/Firefox/Profiles/*/Cache/*'),:force => true end end end Cheers A -- Posted via http://www.ruby-forum.com/.