title: How do you set a cookie in Puppetteer-Sharp?
body: <p>I am attempting to set a cookie in Puppetteer-Sharp, go to a page, and read the innerHtml of an element on the page, however, it appears that the cookie is never set.  How do I appropriately set a cookie in Puppetteer-Sharp?</p>
  
  <pre><code>public async Task&lt;string&gt; RenderPage(string baseUrl, string url, string cookieName, string cookieValue)
      {
        await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision);
        using (var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = false }))      
        {
          using (var page = await browser.NewPageAsync())
          {
            await page.SetCookieAsync(new CookieParam { 
              Name = cookieName, 
              Value = cookieValue, 
              Domain = baseUrl, 
              Url = baseUrl + url 
            });
            await page.GoToAsync(baseUrl + url);
            await page.WaitForSelectorAsync("table.summary-table");
            var cookies = await page.GetCookiesAsync(baseUrl + url);
            var element = await page.QuerySelectorAsync("html");
            var text = await (await element.GetPropertyAsync("innerHTML")).JsonValueAsync&lt;string&gt;();
            Console.WriteLine(text);
            return text;
          }
        }
      }
  </code></pre>
  
  <p>From the Chromium dev console, you can see that there are no cookies for the domain:
  <a href="https://i.stack.imgur.com/WBePp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WBePp.png" alt="no cookies"></a></p>
  
  <p>From the visual studio debugger, you can see that Puppeteer thinks there are no cookies set on the page:</p>
  
  <p><a href="https://i.stack.imgur.com/ZMYHE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZMYHE.png" alt="no cookies on the page"></a></p>