예제 #1
0
 /// <summary>
 /// Implicit Wait for specific duration in Seconds.
 /// </summary>
 /// <param name="iTime">Timeout duration in Seconds.</param>
 /// <returns>Returns true if operation is successfully done otherwise false</returns>
 public WebDriverWait DriverWait(uint iTime = 0)
 {
     if (iTime == 0)
     {
         iTime = FrameGlobals.TimeOutConfig(FrameGlobals.strImplicitWait);
     }
     return(new WebDriverWait(_iDriver, TimeSpan.FromSeconds(iTime)));
 }
예제 #2
0
 public void InitializeDriver(ScenarioContext scenarioContext)
 {
     try
     {
         FrameGlobals.Init();
         if (FrameGlobals.browserType == BrowserTypes.Chrome)
         {
             ChromeOptions chromeCapabilities = new ChromeOptions();
             var           arr = new string[6] {
                 "--start-maximized", "--ignore-certificate-errors", "--disable-popup-blocking", "--disable-default-apps", "--auto-launch-at-startup", "--always-authorize-plugins"
             };
             chromeCapabilities.AddArguments(arr);
             _iWebDriver = new ChromeDriver(chromeCapabilities);
         }
         else if (FrameGlobals.browserType == BrowserTypes.Ie)
         {
             //Deleting cookies in ie browser through command line.
             var procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2");
             var proc          = new System.Diagnostics.Process {
                 StartInfo = procStartInfo
             };
             proc.Start();
             var options = new InternetExplorerOptions
             {
                 IntroduceInstabilityByIgnoringProtectedModeSettings = true,
                 RequireWindowFocus = true,
                 IgnoreZoomLevel    = true,
                 EnableNativeEvents = true
             };
             _iWebDriver = new InternetExplorerDriver(options);
         }
     }catch (Exception ex)
     {
         //ScenarioContext.Current["Exception"] = ex.Message;
         scenarioContext.Add("Exception", ex.Message);
     }
     _iWebDriver.Manage().Timeouts().ImplicitWait = (TimeSpan.FromSeconds(Double.Parse(FrameGlobals.strImplicitWait)));
     _objContainer.RegisterInstanceAs <IWebDriver>(_iWebDriver);
     extScenario = extFeatureName.CreateNode <Scenario>(scenarioContext.ScenarioInfo.Title);
 }