From: Charles Calvert Date: 2010-10-20T01:50:19+09:00 Subject: Re: How to delete the browser cache through ruby On Fri, 24 Sep 2010 05:05:24 -0500, Arihan Sinha wrote in <4dea75d148cec56675b28729009288b8@ruby-forum.com>: >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 . [snip] > 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 It's a bad idea to delete the temporary files at the filesytem level like that. You could cause errors in the IE instance. Instead, Take a look at the Win32API functions that you can use for this: . You can access these functions in Ruby using the Win32API library or the dl/win32 library, both of which are part of the Ruby stdlib. -- Charles Calvert Moderator - alt.computer.consultants.moderated Submission Address: accm@celticwolf.net Contact Address: accm_mod@celticwolf.net