public static void Main() { try { using (IEngine engine = EngineFactory.Create(new EngineOptions.Builder().Build())) { Console.WriteLine("Engine created"); ICookieStore cookieStorage = engine.CookieStore; using (IBrowser browser = engine.CreateBrowser()) { Console.WriteLine("Browser created"); browser.Navigation.LoadUrl(Url).Wait(); IEnumerable <Cookie> cookies = cookieStorage.GetAllCookies(Url).Result; foreach (Cookie cookie in cookies) { Console.WriteLine("cookie = " + cookie); } } } } catch (Exception e) { Console.WriteLine(e); } Console.WriteLine("Press any key to terminate..."); Console.ReadKey(); }
public static void Main() { using (IEngine engine = EngineFactory.Create()) { ICookieStore cookieStorage = engine.Profiles.Default.CookieStore; using (IBrowser browser = engine.CreateBrowser()) { browser.Navigation.LoadUrl(Url).Wait(); IEnumerable <Cookie> cookies = cookieStorage.GetAllCookies(Url).Result; foreach (Cookie cookie in cookies) { Console.WriteLine($"cookie = {cookie}"); } } } Console.WriteLine("Press any key to terminate..."); Console.ReadKey(); }