public BrowserExecutionContextCreator(IBrowserStepExecutionStrategyFactory stepExecutionStrategyFactory, IWebDriverFactory webDriverFactory, ITimeProvider timeProvider) { _stepExecutionStrategyFactory = stepExecutionStrategyFactory; _webDriverFactory = webDriverFactory; _timeProvider = timeProvider; }
protected StepDefinitionBase(IWebDriverFactory f) { if (WebDriverManager == null) { ConfigurationSectionHandler webDriverConfig = (ConfigurationSectionHandler)ConfigurationManager.GetSection("webDriverConfig"); WebDriverManager = new WebDriverManager(webDriverConfig,f); } }
/// <summary> /// Parameter based constructor for a WebDriverManager /// </summary> /// <param name="factory"></param> /// <param name="browser"></param> /// <param name="windowSize"></param> /// <param name="isLocal"></param> /// <param name="platformType"></param> /// <param name="headless"></param> public WebDriverManager(IWebDriverFactory factory, Browser browser, WindowSize windowSize = WindowSize.Hd, bool isLocal = true, PlatformType platformType = PlatformType.Any, bool headless = false) { this.webDriverConstructor = () => factory.GetWebDriver(browser, windowSize, isLocal, platformType, headless); }
/// <summary> /// Configuration based constructor for a WebDriverManager /// </summary> /// <param name="factory"></param> /// <param name="configuration"></param> public WebDriverManager(IWebDriverFactory factory, IWebDriverConfiguration configuration) { this.factory = factory; this.driverConfig = configuration; }
public LoremIpsumCrawler(IWebDriverFactory WebDriverFactory) { _webDriverFactory = WebDriverFactory; _siteURL = "http://www.loremipzum.com/pt/gerador-de-texto"; }
public SeleniumStepDefinitions(IWebDriverFactory wf,IMethodDecorator md,StepContext sc) : base(wf) { _methodDecorator = md; _stepContext = sc; }
public void SetUp() { Assume.That(() => Platform.CurrentPlatform.IsPlatformType(thisPlatformType)); this.WebDriverFactory = new DefaultWebDriverFactory(); }
public Evolution2DefinitionBase(IWebDriverFactory wf, IConfiguration config) : base(wf) { this.config = config; }
public CampaignSteps(CampaignContext cc,IWebDriverFactory f,IConfiguration config) : base(f,config) { _campaignContext = cc; }
private void TryExecuteTest(Action<BrowserWrapper> action, IWebDriverFactory browserFactory, out string browserName, out Exception exception) { var attemptNumber = 0; do { attemptNumber++; exception = null; using (var browser = browserFactory.CreateNewInstance()) { helper = new BrowserWrapper(browser.Driver, this); browserName = browser.GetType().Name; WriteLine($"Testing browser '{browserName}' attempt no. {attemptNumber}"); try { action(helper); } catch (Exception ex) { bool isExpected = false; if (ExpectedExceptionType != null) { isExpected = ex.GetType() == ExpectedExceptionType || (AllowDerivedExceptionTypes && ExpectedExceptionType.IsInstanceOfType(ex)); } if (!isExpected) { TakeScreenshot(attemptNumber, helper); // fail the test exception = ex; } } } } while (exception != null && attemptNumber == SeleniumTestsConfiguration.TestAttemps); }
public SaKiWebDriver(IWebDriverFactory webDriverFactory) { _webDriverFactory = webDriverFactory; }
public ExecutionOptions(IWebDriverFactory webDriverFactory) { WebDriverFactory = webDriverFactory ?? throw new ArgumentNullException(nameof(webDriverFactory)); }
public WebDriverPool(IWebDriverFactory factory, IWebDriverCleaner cleaner) { this.factory = factory; this.cleaner = cleaner; }
public void RegisterBrowserFactory(IWebDriverFactory factory) { BrowserFactories.Add(factory); }
public PoolingDriverFactory(IWebDriverFactory factory) { Factory = factory; }
public WebDriverWrapper(IWebDriverFactory factory) { _factory = factory ?? throw new ArgumentNullException(nameof(factory)); }
public static IWebDriver Create(this IWebDriverFactory webDriverFactory, WebBrowserId webBrowserId) { return(webDriverFactory.Create(WebBrowserInfoFactory.Default.GetInfo(webBrowserId))); }
public LeetCodeProblemParser(IWebDriverFactory webDriverFactory, ILogger <LeetCodeProblemParser> logger) { this.webDriverFactory = webDriverFactory; this.logger = logger; }
public WebDriverService(IWebDriverFactory webDriverFactory) { this.webDriverFactory = webDriverFactory; }
//[AssemblyInitialize] public static void AssemblyInitialize(TestContext context) { var webDriverType = (string)context.Properties["WebDriver"]; var executableLocation = (string)context.Properties["ExecutableLocation"]; var baseUrl = (string)context.Properties["BaseUrl"]; var commandTimeout = int.Parse((string)context.Properties["CommandTimeout"]); var seleniumHost = (string)context.Properties["SeleniumHost"]; var workingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); switch (webDriverType) { case "remotefirefox": var remoteFirefoxOptions = new FirefoxOptions(); remoteFirefoxOptions.BrowserExecutableLocation = executableLocation; remoteFirefoxOptions.AddArguments(new string[] { "--headless" }); JGTest.factory = new RemoteDriverFactory(new Uri(seleniumHost), remoteFirefoxOptions.ToCapabilities(), TimeSpan.FromSeconds(commandTimeout)); break; case "remotechrome": var remoteChromeOptions = new ChromeOptions(); remoteChromeOptions.AddArguments(new string[] { "--no-sandbox", "--headless", "--disable-gpu" }); JGTest.factory = new RemoteDriverFactory(new Uri(seleniumHost), remoteChromeOptions.ToCapabilities(), TimeSpan.FromSeconds(commandTimeout)); break; case "firefox": var firefoxOptions = new FirefoxOptions(); firefoxOptions.BrowserExecutableLocation = executableLocation; firefoxOptions.AddArguments(new string[] { "--headless" }); JGTest.factory = new FirefoxDriverFactory(workingDirectory, firefoxOptions, TimeSpan.FromSeconds(commandTimeout)); break; case "chrome": default: var chromeOptions = new ChromeOptions(); chromeOptions.AddArguments(new string[] { "--no-sandbox", "--headless", "--disable-gpu" }); // NOTE: the "single driver" approach does not seem to work with ChromeDriver 2.40.0 on Linux //var chromeService = ChromeDriverService.CreateDefaultService(workingDirectory); //chromeService.Start(); //JGTest.service = chromeService; JGTest.factory = new ChromeDriverFactory(workingDirectory, chromeOptions, TimeSpan.FromSeconds(commandTimeout)); break; } JGTest.baseUrl = new Uri(baseUrl); }
public UpsheetSteps(UpsheetContext context,StepContext stepContext,IWebDriverFactory f,IConfiguration config) : base(f,config) { _context = context; _stepContext = stepContext; }
public ByteCounterCrawler(IWebDriverFactory WebDriverFactory) { _webDriverFactory = WebDriverFactory; _nonDigits = new Regex(@"\D", RegexOptions.Compiled); _siteURL = "https://mothereff.in/byte-counter#"; }
public WebDriver(IWebDriverFactory wf, string hubUri, int commandTimeout, string browserName, DesiredCapabilitiesConfigCollection capabilities, int? browserHeight, int? browserWidth, List<string> browserTags, string version, string platform, string key) { Instance = wf.GetWebDriver( new WebDriverParameters { hubUri = hubUri, commandTimeout = commandTimeout, capabilities = capabilities, browserHeight = browserHeight, browserWidth = browserWidth, browserName = browserName, browserTags = browserTags, } ); Platform = platform; Version = version; BrowserName = browserName; OriginalBrowserHeight = browserHeight; OriginalBrowserWidth = browserWidth; BrowserTags = browserTags; Key = key; }
public Browser(IWebDriverFactory webDriverFactory) { CreateUploadDwonloadDirectory(); this.webDriverFactory = webDriverFactory; ObjReport.ExtentReportsSetup(); }