View Javadoc

1   package com.atlassian.pageobjects.util;
2   
3   import com.atlassian.pageobjects.browser.Browser;
4   import com.atlassian.pageobjects.browser.BrowserAware;
5   import com.google.common.base.Supplier;
6   
7   /**
8    * Utilities for manipulating the current browser.
9    *
10   * @deprecated it is now possible to inject {@link BrowserAware}, or even {@link Browser} directly into your page
11   * objects/tests. Scheduled for removal in 3.0
12   */
13  public class BrowserUtil
14  {
15      private static Browser currentBrowser;
16  
17      public static void setCurrentBrowser(Browser browser)
18      {
19          currentBrowser = browser;
20      }
21  
22      public static Browser getCurrentBrowser()
23      {
24          return currentBrowser;
25      }
26  
27      public static Supplier<Browser> currentBrowserSupplier()
28      {
29          return new Supplier<Browser>()
30          {
31              @Override
32              public Browser get()
33              {
34                  return getCurrentBrowser();
35              }
36          };
37      }
38  }