Beispiel #1
0
        /// <summary>
        /// Checks wither the page matches the current browser URL.
        /// </summary>
        /// <param name="pageType">Type of the page.</param>
        /// <param name="page">The page to do further testing if it exists.</param>
        /// <param name="actualPath">The actual path.</param>
        /// <param name="expectedPath">The expected path.</param>
        /// <returns><c>true</c> if it is a match.</returns>
        protected bool CheckIsOnPage(Type pageType, IPage page, out string actualPath, out string expectedPath)
        {
            var validateRegex = UriHelper.GetQualifiedPageUriRegex(this, pageType);

            var actualUrls = this.GetNativePageLocation(page);

            expectedPath = validateRegex.ToString();
            actualPath   = string.Join(", ", actualUrls);

            return(actualUrls.Any(validateRegex.IsMatch));
        }
Beispiel #2
0
        /// <summary>
        /// Navigates to the specified URL defined by the page.
        /// </summary>
        /// <param name="pageType">Type of the page.</param>
        /// <param name="parameters">The parameters to fill in any blanks.</param>
        /// <returns>
        /// The page object when navigated to.
        /// </returns>
        public IPage GoToPage(Type pageType, IDictionary <string, string> parameters)
        {
            var filledUri = UriHelper.FillPageUri(this, pageType, parameters);

            try
            {
                this.logger.Debug("Navigating to URL: {0}", filledUri);
                this.GoTo(new Uri(filledUri));
            }
            catch (Exception ex)
            {
                throw new PageNavigationException("Could not navigate to URI: {0}. Details: {1}", filledUri, ex.Message);
            }

            return(this.CreateNativePage(pageType, true));
        }