42 lines
1000 B
C#
42 lines
1000 B
C#
using System;
|
|
using IntegrationTests.Helpers.Pages;
|
|
using IntegrationTests.Properties;
|
|
using OpenQA.Selenium;
|
|
using OpenQA.Selenium.Firefox;
|
|
|
|
namespace IntegrationTests.Helpers
|
|
{
|
|
public class WebDriverContext
|
|
{
|
|
#region Properties
|
|
|
|
public IWebDriver WebDriver { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region Methods & Constructors
|
|
|
|
private WebDriverContext()
|
|
{
|
|
WebDriver = new FirefoxDriver(new FirefoxBinary(), new FirefoxProfile(), TimeSpan.FromMinutes(5)) {Url = Settings.Default.WebSiteUrl};
|
|
}
|
|
|
|
public static WebDriverContext GetInstance()
|
|
{
|
|
return new WebDriverContext();
|
|
}
|
|
|
|
#endregion
|
|
|
|
public T CreatePage<T>(string url) where T : BasePage, new()
|
|
{
|
|
WebDriver.Url = url;
|
|
WebDriver.Navigate();
|
|
Browser.WaitForAjax(WebDriver);
|
|
var page = new T();
|
|
page.Init(WebDriver);
|
|
return page;
|
|
}
|
|
}
|
|
}
|