title: How to switch to a different window using selenium webdriver java?
body: <p>I am trying to switch to a New window which gets displayed when I click on the Debt Pricing Template. But I am unable to do that as a result of which I am not able to proceed with further scripting... The problem is I am not able to know what should I pass in the <code>switchTo.window()</code> because Pricing Approval Gateway window displays and following is the HTML for the new window:</p>
  
  <pre><code>&lt;*h1 class="pageType noSecondHeader"&gt;Pricing Approval Gateway&lt;*/h1&gt;
  </code></pre>
  
  <p>Following is the code:</p>
  
  <pre><code>LoginPage2.driver.findElement(By.linkText("TEST ORG")).click();
  
  System.out.println("3.Select Dept pricing template button from the organization detail page.");
  
  if(LoginPage2.driver.findElement(By.name("debt_pricing_template")).isDisplayed())
  
  System.out.println("User should able to navigate to Dept pricing template and template display few question, user have answer these question for further navigation.");
  
  LoginPage2.driver.findElement(By.name("debt_pricing_template")).click();
  
  LoginPage2.driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
  
  LoginPage2.driver.switchTo().window("bPageTitle");
  </code></pre>
  
  <p>Please advise what needs to be added?</p>