From: Dhruva Sagar Date: 2010-09-24T19:13:11+09:00 Subject: Re: How to delete the browser cache through ruby --000325576e52181e3e0490fea0a3 Content-Type: text/plain; charset=UTF-8 I think it is probably a better idea to ensure that the cache expires in due time, rather than trying to clear it programmatically. -- Thanks & Regards, Dhruva Sagar. On Fri, Sep 24, 2010 at 15:35, Arihan Sinha wrote: > 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/. > > --000325576e52181e3e0490fea0a3--