Skip to content

BaseDriver Settings example

VolodymyrRomanyshyn edited this page Aug 13, 2019 · 3 revisions

Settings class

Initialization of BaseDriver can be made with settings: Settings.PageSettings

Settings class:

public static class Settings
    {
        public static ISettings PageSettings => new PageSettings();
    }

PageSettings class:

public class PageSettings : ISettings
    {
        public TimeSpan TimeWait => TimeSpan.FromSeconds(25);
        public TimeSpan ReportTimeWait => TimeSpan.FromSeconds(120);
        public string Browser => "chrome";
    }

There are three parameters can be set for BaseDriver:

  • TimeWait -- waiting time for all elements on the page
  • ReportTimeWait -- waiting time for all ReportPages
  • Browser -- type of browser

Example of PageObjects

public class YourPage : BasePage, ILoad
    {
        // your elements here
        [Id("UserName")] public TextInputField UserName;
        
        public YourPage() : base(new BaseDriver(Settings.PageSettings), "http:YourLink.com")
        {
        }

        public bool IsLoaded() =>
            UserName.IsVisible;
    }

Example of Reports PageObjects

public class YourReportPage: BaseReportPage, ILoad
    {
        // your elements here
        [Id("UserName")] public TextInputField UserName;
        
        public YourReportPage() : base(driver)
        {
        }

        public bool IsLoaded() =>
            UserName.IsVisible;
    }
Clone this wiki locally