/// <summary>
        /// Creates the specified target browsing context.
        /// </summary>
        /// <param name="context">The current context.</param>
        /// <param name="target">The specified target name.</param>
        /// <returns>The new context.</returns>
        public static IBrowsingContext CreateChildFor(this IBrowsingContext context, String target)
        {
            var security = Sandboxes.None;

            if (target.Is("_blank"))
            {
                target = null;
            }

            return(context.CreateChild(target, security));
        }
Beispiel #2
0
        public async Task <IDocument> GetDocument(string url)
        {
            var foundBrowsingContext = _browsingContext.FindChild(url);

            if (foundBrowsingContext == null)
            {
                var newBrowsingContext = _browsingContext.CreateChild(url, Sandboxes.None);
                // When I'm using await, it doesn't work, this is temporary solution
                var openedDocument = await newBrowsingContext.OpenAsync(url);

                return(openedDocument);
            }

            return(await foundBrowsingContext.OpenAsync(url));
        }