title: How to use @FindBy for driver.findElements(By.xpath()).size>0
body: <p>Currently I am using @FindBy annotation for an element as below</p>
  
  <pre><code>@FindBy(xpath = "//a[@class='fNiv' and contains(text(), 'Home')]")
  public static WebElement Tab_Home;
  </code></pre>
  
  <p>But when I try using Boolean I am getting an error "Change to getSize()" and my Boolean syntax is</p>
  
  <pre><code>//AllGeneralTabs is the class name where I have stored my elements
  Boolean home=AllGeneralTabs.Tab_Home.size()&gt;0;
  </code></pre>
  
  <p>I want something to work in such a way when I define my Element as</p>
  
  <pre><code>public static final By Tab_Home=By.xpath("//a[@class='fNiv' and contains(text(), 'Home')]");
  </code></pre>
  
  <p>then the Boolean will work perfectly for the below syntax</p>
  
  <pre><code>Boolean home=driver.findElements(AllGeneralTabs.Tab_Home).size()&gt;0;
  </code></pre>
  
  <p>It returns true/False and works as expected but this is not happening for @FindBy annotation. As I defined all my elements using @FindBy now and I cannot go back and change it to final statement, I don't have time.</p>