public void Start <TPage>(MainFlowData mainFlowData, Action <TPage> action) where TPage : UIPage { using (var driver = new WebDriverWrapper()) { AddRunningDriver(driver); driver.BrowserStart(); try { mainFlowData.WindowsHandlerData.StartPageId = driver.WebDriver.CurrentWindowHandle; var page = UIPage.CreatePage <TPage>(driver); action(page); } catch (Exception ex) { var screenshotFile = driver.TakeScreenshot(TestContext.CurrentContext.Test.MethodName); TestContext.AddTestAttachment(screenshotFile); throw ex; } finally { RemoveRunningDriver(driver); } } }
public void Start <TPage>(Underwriter userName, string password, Action <TPage> action) where TPage : UIPage { using (var driver = new WebDriverWrapper()) { AddRunningDriver(driver); driver.Configuration.UserName = userName.ToString(); driver.Configuration.UserPass = password; driver.BrowserStart(); try { var page = UIPage.CreatePage <TPage>(driver); action(page); } catch (Exception ex) { var screenshotFile = driver.TakeScreenshot(TestContext.CurrentContext.Test.MethodName); TestContext.AddTestAttachment(screenshotFile); throw ex; } finally { RemoveRunningDriver(driver); } } }