Class WebPage is located in the Mapping project and is the base class for all classes which are description and projection of real web pages related to the application under test. The philosophy of the framework is that every single real page must be described with a separate class, therefore one page is equal to one class. The WebPage class does not describe a real page, it is abstract and it contains general for all web pages functionality which is used by all its children. Since the WebPage is abstract you cannot create an instance of it. The class implements the interface IPage and its properties Name, Title, Url. Also, it contains abstract property IsLoaded, which must be implemented personally by every child, and the method WaitUntilIsLoaded which verifies if the page is completely loaded and waits until it is.
The class is located in the WebPage.cs file in the Mapping project.
• IWebDriver instance declared as a property with private set access. Maybe initialized only in the constructor;
• Class constructor. The first parameter is an instance of IWebDriver interface (it is the instance which is initialized in BaseTest class with SetUpDriverInstance() method, then passed to the WebApplication class as a parameter), the second parameter is a time in seconds, which is maximum period for the page loading. If the parameter is not passed, Globals.timeoutForPageLoading variable is used. The parameter is used for waiting until the page is completely loaded. If it didn’t happen within the expected time an exception will be thrown;
• Properties Name, Title, and Url, declared in IWebPage interface. I believe that their purpose is clear without explanation;
• Abstract property IsLoaded. It should indicate if the page is already completely loaded. Since the property is abstract every child of the WebPage class must implement it in its own way, so the property logic will be unique for every single page;
• Method void WaitUntilIsLoaded(int timeout). It verifies if the page is loaded (IsLoaded property is true), and if not the method does nothing for a specified period of time, then it verifies again IsLoaded property. If the total waiting time is equal or more than timeout parameter new error message will be added to the report.
WebApplication class Table Of Content Switching Between tabs and frames