Exemple #1
0
        /// <summary>
        /// Adds the cookie to the browser.
        /// </summary>
        /// <param name="name">The cookie name.</param>
        /// <param name="value">The cookie value.</param>
        /// <param name="path">The path.</param>
        /// <param name="expireDateTime">The expiration date time.</param>
        /// <param name="domain">The cookie domain.</param>
        /// <param name="secure">if set to <c>true</c> the cookie is secure.</param>
        /// <exception cref="System.NotImplementedException">Currently not implemented.</exception>
        public override void AddCookie(
            string name,
            string value,
            string path,
            DateTime?expireDateTime,
            string domain,
            bool secure)
        {
            var localWindow = this.window.Value;

            localWindow.ExecuteScript(CookieBuilder.CreateCookie(name, value, path, expireDateTime, domain, secure));
        }
Exemple #2
0
        /// <summary>
        /// Get a cookie from the browser
        /// </summary>
        /// <param name="name">The name of the cookie</param>
        /// <returns>The cookie (if exists)</returns>
        public override Cookie GetCookie(string name)
        {
            var    localWindow = this.window.Value;
            var    result      = localWindow.ExecuteScript(CookieBuilder.GetCookieValue(name));
            Cookie cookie      = null;

            if (result != null)
            {
                cookie = new Cookie(name, result.ToString());
            }

            return(cookie);
        }