Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.