/// <summary>
 /// Translates a <see cref="Cookie"/> to the format to use with the Chrome DevTools Protocol cookie
 /// manipulation methods.
 /// </summary>
 /// <param name="cookie">The <see cref="Cookie"/> to translate.</param>
 /// <returns>A command settings object suitable for use with the Chromium DevTools Protocol manipulation methods.</returns>
 public static Network.SetCookieCommandSettings ToDevToolsSetCookieCommandSettings(this Cookie cookie)
 {
     Network.SetCookieCommandSettings commandSettings = new Network.SetCookieCommandSettings();
     commandSettings.Name     = cookie.Name;
     commandSettings.Value    = cookie.Value;
     commandSettings.Domain   = cookie.Domain;
     commandSettings.Path     = cookie.Path;
     commandSettings.HttpOnly = cookie.IsHttpOnly;
     commandSettings.Secure   = cookie.Secure;
     commandSettings.Expires  = cookie.ExpirySeconds;
     return(commandSettings);
 }
Esempio n. 2
0
 /// <summary>
 /// Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
 /// </summary>
 public async Task <SetCookieCommandResponse> SetCookie(SetCookieCommandSettings command, CancellationToken cancellationToken = default(CancellationToken), int?millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
 {
     return(await m_session.SendCommand <SetCookieCommandSettings, SetCookieCommandResponse>(command, cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived));
 }