Ejemplo n.º 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);
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 4
0
 public static final void setWds(WdsProvider provider) {
   UiDriverPluginService.driverPlugins().beforeInstantiateDriver();
   providers.set(provider);
   UiDriverPluginService.driverPlugins().afterInstantiateDriver(provider.wds());
 }