Skip to content

Instantly share code, notes, and snippets.

@testautomationtribe
Created October 23, 2017 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save testautomationtribe/6150b33769b0a5730b2ace343b5bab67 to your computer and use it in GitHub Desktop.
Save testautomationtribe/6150b33769b0a5730b2ace343b5bab67 to your computer and use it in GitHub Desktop.
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using TechTalk.SpecFlow;
namespace TatAuto.Bindings.Hooks
{
    [Binding]
    public class GeneralHooks
    {
        private IWebDriver _driver;     
        [BeforeScenario]
        public void RunBeforeScenario()
        {
            _driver = new ChromeDriver();
            _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            _driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(10);
            _driver.Manage().Window.Maximize();
            ScenarioContext.Current.Add("currentDriver", _driver);
        }
        [AfterScenario]
        public void RunAfterScenario()
        {
           _driver?.Quit();
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment