Skip to content
Jakub Raczek edited this page Jan 19, 2016 · 15 revisions
 public class InternetPage : ProjectPageBase
    {
        private static readonly Logger Logger = LogManager.GetCurrentClassLogger();

        /// <summary>
        /// Locators for elements
        /// </summary>
        private readonly ElementLocator
            linkLocator = new ElementLocator(Locator.CssSelector, "a[href='/{0}']");

        public InternetPage(DriverContext driverContext) : base(driverContext)
        {
        }

        /// <summary>
        /// Methods for this HomePage
        /// </summary>
        public InternetPage OpenHomePage()
        {
            var url = this.GetUrlValue();
            this.Driver.NavigateTo(new Uri(url));
            Logger.Info(CultureInfo.CurrentCulture, "Opening page {0}", url);
            return this;
        }
        
        public InternetPage OpenHomePageWithUserCredentials()
        {
            var url = this.GetUrlValueWithUserCredentials();
            this.Driver.NavigateTo(new Uri(url));
            Logger.Info(CultureInfo.CurrentCulture, "Opening page {0}", url);
            return this;
        }
        
        public BasicAuthPage GoToBasicAuthPage()
        {
            this.Driver.GetElement(this.linkLocator.Evaluate("basic_auth")).Click();
            return new BasicAuthPage(this.DriverContext);
        }
   }
Clone this wiki locally