Exemplo n.º 1
0
        public async Task CanSetCookieForDomain(string name, string value, string domain, CookieSameSite sameSite)
        {
            using (var browser = new ChromiumWebBrowser("www.google.com"))
            {
                await browser.WaitForInitialLoadAsync();

                using (var devToolsClient = browser.GetDevToolsClient())
                {
                    var expiry   = DateTimeOffset.UtcNow.AddDays(10);
                    var response = await devToolsClient.Network.SetCookieAsync(name, value, domain : domain, sameSite : sameSite, expires : expiry.ToUnixTimeSeconds());

                    Assert.True(response.Success, "SetCookieForDomain");
                }
            }
        }
Exemplo n.º 2
0
        public async Task CanSetCookieForDomain(string name, string value, string domain, CookieSameSite sameSite)
        {
            using (var browser = new ChromiumWebBrowser("www.google.com"))
            {
                await browser.LoadPageAsync();

                using (var devToolsClient = browser.GetDevToolsClient())
                {
                    var response = await devToolsClient.Network.SetCookieAsync(name, value, domain : domain, sameSite : sameSite);

                    Assert.True(response.Success, "SetCookieForDomain");
                }
            }
        }