title: Get title of window without switching in selenium webdriver
body: <p>Is there any way to get window title without making any switch in selenium?</p>
  
  <p>presently I'm using below code:</p>
  
  <pre><code>public boolean switchToWindowByTitle(String title){
      String currentWindow = driver.getWindowHandle(); 
      Set&lt;String&gt; availableWindows = driver.getWindowHandles(); 
      if (!availableWindows.isEmpty()) { 
           for (String windowId : availableWindows) {
                String switchedWindowTitle=driver.switchTo().window(windowId).getTitle();
                if ((switchedWindowTitle.equals(title))||(switchedWindowTitle.contains(title))){ 
                    return true; 
                } else { 
                  driver.switchTo().window(currentWindow); 
                } 
            } 
       } 
       return false;
  }
  </code></pre>