private static void EnsureScreenshotFolder(ISeleniumConfig config) { if (!Directory.Exists(config.ScreenShotFolder)) { Directory.CreateDirectory(config.ScreenShotFolder); } }
private static IWebDriver CreateFirefoxDriver(ISeleniumConfig config) { // firefox does not care about DriverDirectory return(string.IsNullOrEmpty(config.BrowserPath) ? new FirefoxDriver() : new FirefoxDriver(new FirefoxBinary(config.BrowserPath), new FirefoxProfile())); }
private void TakeScreenshot(ISeleniumConfig config) { var screenshot = (_webDriver as ITakesScreenshot).GetScreenshot(); var filename = $"{ScenarioContext.Current.ScenarioInfo.Title}.png"; EnsureScreenshotFolder(config); File.WriteAllBytes(filename, screenshot.AsByteArray); }
private static IWebDriver CreateChromeDriver(ISeleniumConfig config) { var options = new ChromeOptions(); // --no-sandbox allows the test to be run under VS2013 in some cases // --ignore-certificate-errors allow our self signed, untrusted certs // --enable-logging --v=1 will also log messages from chrome, including console.log() // to chrome_debug.log in Chrome's user data directory (in the parent directory of Default/) options.AddArgument("--no-sandbox --ignore-certificate-errors"); if (!string.IsNullOrEmpty(config.BrowserPath)) { options.BinaryLocation = config.BrowserPath; } var driver = string.IsNullOrWhiteSpace(config.DriverDirectory) ? new ChromeDriver(options) : new ChromeDriver(config.DriverDirectory, options); return(driver); }
public StepDefinitions(ISeleniumConfig configuration) { _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); }
protected Page(IWebDriver webDriver, ISeleniumConfig seleniumConfig) { _webDriver = webDriver; _seleniumConfig = seleniumConfig; }
public NavigationSteps(IWebDriver webDriver, ISeleniumConfig config) { _webDriver = webDriver; _config = config; }
public SamplePage(IWebDriver webDriver, ISeleniumConfig seleniumConfig) : base(webDriver, seleniumConfig) { }
public CommonSteps(IWebDriver webDriver, ISeleniumConfig seleniumConfig) { _webDriver = webDriver; _seleniumConfig = seleniumConfig; }
public IncludeScenarioTags(ISeleniumConfig config) { _config = config; }
protected DependancyResolution(IObjectContainer objectContainer) { _objectContainer = objectContainer; _seleniumConfig = ResolveSeleniumConfig(); }