public void Navigate(string url)
        {
            bool tryAgain = false;

            try
            {
                WrappedDriver.Navigate().GoToUrl(url);
            }
            catch (Exception)
            {
                tryAgain = true;
            }

            if (tryAgain)
            {
                try
                {
                    WrappedDriver.Navigate().GoToUrl(url);
                }
                catch (Exception ex)
                {
                    throw new Exception($"Navigation to page {url} has failed after two attempts. Error was: {ex.Message}");
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Logs a user out if logged in.
        /// </summary>
        /// <returns></returns>
        public virtual T Logout <T>() where T : IPageObject
        {
            if (IsLoggedIn())
            {
                var logoutUrl = new Uri(Uri, "/logout");
                WrappedDriver.Navigate().GoToUrl(logoutUrl);
            }

            var afterLogoutPage = pageObjectFactory.PreparePage <T>();

            return(afterLogoutPage);
        }
        private void NavigateToUri()
        {
            var uri = Route.BindByName(
                BaseUri,
                new Dictionary <string, string>());

            var url          = uri.ToString();
            var alreadyOnUrl = String.Equals(
                url,
                WrappedDriver.Url,
                StringComparison.OrdinalIgnoreCase);

            if (!alreadyOnUrl)
            {
                WrappedDriver.Navigate().GoToUrl(uri);
            }
        }
        /// <summary>
        /// Replaces the variables in the <see cref="IPageObject.Route" /> with
        /// the parameters and navigates to that url (if not on it already)
        /// then calls <see cref="ILoadableComponent.Load" />.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// Thrown if the <see cref="IDictionary{TKey, TValue}"/> argument is
        /// null.
        /// </exception>
        public virtual ILoadableComponent Load(IDictionary <string, string> parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            // Need to extract the authority section of the route template.
            var uri = Route.BindByName(BaseUri, parameters);

            // Navigate to the url.
            var alreadyOnUrl = String.Equals(
                uri.ToString(),
                WrappedDriver.Url,
                StringComparison.OrdinalIgnoreCase);

            if (!alreadyOnUrl)
            {
                WrappedDriver.Navigate().GoToUrl(uri);
            }

            return(Load());
        }
Beispiel #5
0
 public void Navigate(Uri uri) => WrappedDriver.Navigate().GoToUrl(uri);
Beispiel #6
0
 public void Navigate(string url) => WrappedDriver.Navigate().GoToUrl(url);
Beispiel #7
0
 public void Refresh() => WrappedDriver.Navigate().Refresh();
 public void GoToPersonPage(int personId)
 {
     WrappedDriver.Navigate().GoToUrl(Constants.PEOPLE + "/" + personId);
 }
 public void GoToLoginPage()
 {
     WrappedDriver.Navigate().GoToUrl(Constants.LOGINPAGE);
 }
Beispiel #10
0
 public void GoTo() => WrappedDriver.Navigate().GoToUrl(Url);
Beispiel #11
0
 public void GoTo() => WrappedDriver.Navigate().GoToUrl(GetUrl());
Beispiel #12
0
 public void GoToCreatePersonPage()
 {
     WrappedDriver.Navigate().GoToUrl(Constants.CREATEPERSON);
 }
Beispiel #13
0
 public PracticePage()
 {
     // Navigate to PMA
     WrappedDriver.Navigate().GoToUrl("http://automationpractice.com/");
 }
 public void GoTo(string url)
 {
     //AssertDisposed();
     WrappedDriver.Navigate().GoToUrl(url);
 }
 /// <summary>
 /// Instructs the driver to navigate the browser to another location.
 /// </summary>
 /// <returns>
 /// An <see cref="INavigation"/> object allowing the user to access
 /// the browser's history and to navigate to a given URL.
 /// </returns>
 public INavigation Navigate()
 {
     return(WrappedDriver.Navigate());
 }
 public void Refresh()
 {
     WrappedDriver.Navigate().Refresh();
     WaitForPageLoad();
 }
 public void GoToPeoplePage()
 {
     WrappedDriver.Navigate().GoToUrl(Constants.PEOPLE);
 }
Beispiel #18
0
 public void Back() => WrappedDriver.Navigate().Back();
Beispiel #19
0
 public void Navigate() => WrappedDriver.Navigate().GoToUrl(_url);
Beispiel #20
0
 public void Forward() => WrappedDriver.Navigate().Forward();
 public void GoToDashBoardPage()
 {
     WrappedDriver.Navigate().GoToUrl(Constants.DASHBOARD);
 }