Пример #1
0
 private static WebDriver wdsInstance() {
   WebDriver wds = providers.get().wds();
   UiDriverPluginService.driverPlugins().beforeGetDriver();
   if (wdsInstances.get(wds) == null) {
     wdsInstances.put(wds, new VisibleElementFilter(providers.get().wds()));
   }
   UiDriverPluginService.driverPlugins().afterGetDriver(wdsInstances.get(wds));
   return wdsInstances.get(wds);
 }
Пример #2
0
 public static final WebDriver getDriver() {
   UiDriverPluginService.driverPlugins().beforeGetDriver();
   if (isWds()) return wdsInstance();
   if (instance() == null || isWrong(instance())) {
     UiDriverPluginService.driverPlugins().beforeInstantiateDriver();
     WebDriver dr = new VisibleElementFilter(createRemoteDriver());
     instances.set(dr);
     Runtime.getRuntime().addShutdownHook(closeDriver(instance()));
     UiDriverPluginService.driverPlugins().afterInstantiateDriver(dr);
   }
   UiDriverPluginService.driverPlugins().afterGetDriver(instance());
   return instance();
 }
Пример #3
0
 public static void closeDriver() {
   UiDriverPluginService.driverPlugins().beforeCloseDriver(instance());
   if (instance() != null) {
     try {
       instance().close();
       if (!dontUseQuit()) {
         instance().quit();
       }
     } catch (Throwable ignore) {
       ignore.printStackTrace();
     }
     instances.set(null);
   }
   UiDriverPluginService.driverPlugins().afterCloseDriver();
 }
Пример #4
0
 public static final void setWds(WdsProvider provider) {
   UiDriverPluginService.driverPlugins().beforeInstantiateDriver();
   providers.set(provider);
   UiDriverPluginService.driverPlugins().afterInstantiateDriver(provider.wds());
 }