title: is there a way to Click OK in pop window on chrome using Selenium Webdriver
body: <p>I am creating a test project where when clicking on a button system pops-up a window where I need to click OK but unable to do using the following code:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Test
  public void testAddNewUserMakeSuperUser() throws Exception {
      driver.get("https://webqa.searshc.com/ssod/Admin/createUser.html");
      driver.findElement(By.id("saveUserDetails")).click();
      Alert alert = driver.switchTo().alert();
      System.out.println(alert.getText());
      alert.accept();
  }
  </code></pre>
  
  <p>I have used </p>
  
  <pre class="lang-java prettyprint-override"><code>executeScript = ((JavascriptExecutor) driver).executeScript("window.confirm = function(msg) { return true; }");
  </code></pre>
  
  <p>also... but I am unable to run this.</p>