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 DownloadPage GoToFileDownloader()
        {
            this.Driver.GetElement(this.linkLocator.Evaluate("download")).Click();
            return new DownloadPage(this.DriverContext);
        }
   }
Clone this wiki locally