Facebook
From Emerald Duck, 4 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 316
  1. [BeforeScenario("web")]
  2.         public static void InitWebScenario()
  3.         {
  4.             InitWithUri(new Uri((Kernel ?? throw new InvalidOperationException()).Get<EnvironmentParams>().StrWebDriverRemoteAddressMpek));
  5.         }
  6.  
  7.         [BeforeScenario("webAPalac")]
  8.         public static void InitWebScenariosdsdd()
  9.         {
  10.             InitWithUri(new Uri((Kernel ?? throw new InvalidOperationException()).Get<EnvironmentParams>().StrWebDriverRemoteAddressMpek));
  11.         }
  12.  
  13.         private static void InitWithUri(Uri uri)
  14.         {
  15.             var options = new ChromeOptions();
  16.             options.AddArgument("--start-maximized");
  17.  
  18.             if (!Kernel.GetBindings(typeof(IWebDriver)).Any())
  19.                 Kernel.Bind<IWebDriver>().To<RemoteWebDriver>().InSingletonScope()
  20.                     .WithConstructorArgument("remoteAddress", uri)
  21.                     .WithConstructorArgument("options", options);
  22.         }