Ejemplo n.º 1
0
 private static void EnsureScreenshotFolder(ISeleniumConfig config)
 {
     if (!Directory.Exists(config.ScreenShotFolder))
     {
         Directory.CreateDirectory(config.ScreenShotFolder);
     }
 }
Ejemplo n.º 2
0
 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()));
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public StepDefinitions(ISeleniumConfig configuration)
 {
     _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
 }
Ejemplo n.º 6
0
 protected Page(IWebDriver webDriver, ISeleniumConfig seleniumConfig)
 {
     _webDriver      = webDriver;
     _seleniumConfig = seleniumConfig;
 }
Ejemplo n.º 7
0
 public NavigationSteps(IWebDriver webDriver, ISeleniumConfig config)
 {
     _webDriver = webDriver;
     _config    = config;
 }
Ejemplo n.º 8
0
 public SamplePage(IWebDriver webDriver, ISeleniumConfig seleniumConfig)
     : base(webDriver, seleniumConfig)
 {
 }
Ejemplo n.º 9
0
 public CommonSteps(IWebDriver webDriver, ISeleniumConfig seleniumConfig)
 {
     _webDriver      = webDriver;
     _seleniumConfig = seleniumConfig;
 }
Ejemplo n.º 10
0
 public IncludeScenarioTags(ISeleniumConfig config)
 {
     _config = config;
 }
Ejemplo n.º 11
0
 protected DependancyResolution(IObjectContainer objectContainer)
 {
     _objectContainer = objectContainer;
     _seleniumConfig  = ResolveSeleniumConfig();
 }