前几天看到Ruben在Watir Forum中发表的有关如何用watir脚本清除ie的cookies的帖子
今天正好用到,在此记一下
require 'watir'
require 'thread'
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'watir/testUnitAddons'
require 'watir/cookiemanager'
include Watir
#clear the cookies
print Watir::CookieManager::WatirHelper.getSpecialFolderLocation(Watir::CookieManager::WatirHelper::COOKIES)
Watir::CookieManager::WatirHelper.deleteSpecialFolderContents(Watir::CookieManager::WatirHelper::COOKIES)
#clear the cathes
print Watir::CookieManager::WatirHelper.getSpecialFolderLocation(Watir::CookieManager::WatirHelper::INTERNET_CACHE)
Watir::CookieManager::WatirHelper.deleteSpecialFolderContents(Watir::CookieManager::WatirHelper::INTERNET_CACHE)