テスト環境が Windows システムで実行されている場合 (そのように聞こえます)、pInvoke を使用してキャッシュを操作できます。次の 4 つの方法が必要です。残念ながら、コードは私ではなく、私が働いている会社が所有しているため、ここにすべてを貼り付けることはできません。「FindFirstUrlCacheEntry」と「FindNextUrlCacheEntry」を使用して、キャッシュ内のエントリを反復処理する必要があります。キャッシュ エントリをチェックして、それが Cookie であるかどうかを確認し、関心のあるドメインに属しているかどうかを確認します。そうである場合は削除できます。
[DllImport (@"wininet", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindFirstUrlCacheEntry ([MarshalAs (UnmanagedType.LPTStr)] string searchPattern, IntPtr ptrCacheEntryInfo, ref int cacheEntryInfoSize);
[DllImport (@"wininet", SetLastError = true, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
private static extern bool FindNextUrlCacheEntry (IntPtr ptrCacheHandler, IntPtr ptrCacheEntryInfo, ref int cacheEntryInfoSize);
[DllImport (@"wininet", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
private static extern bool FindCloseUrlCache (IntPtr ptrCacheEntryInfo);
[DllImport ("wininet.dll", SetLastError = true, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
private static extern bool DeleteUrlCacheEntry (IntPtr lpszUrlName);