title: After navigating from one tab to another in selenium webdriver, the xpath for a button does not work, how can I make it work?
body: <pre><code>// opening the base URL
  
  driver1.get(baseUrl+"/");
  
  // opening a new tab
  
  driver1.findElement(By.cssSelector("Body")).sendKeys(Keys.COMMAND + "t");
  
  driver1.get("my URL"); 
  
  // getting back to the first tab             
  
  driver1.findElement(By.cssSelector("body")).sendKeys(Keys.COMMAND, Keys.SHIFT, "{");
  
  // I want to signup by clicking the sign up button
  
  driver1.findElement(By.xpath("/html/body/div[1]/header/div[2]/button")).click();
  </code></pre>
  
  <p>The error that I get after running is :
   "Error communicating with the remote browser. It may have died." </p>
  
  <p>But when I run the same code without the navigation, the button click works fine, then it means there is no problem with the xpath. </p>