title: How to generate a javascript alert with a small string message using Selenium Java WebDriver
body: <p>I am trying to generate or popup a java-script alert window with a string message from within the Selenium Java program while it is running. I read somewhere that we can execute javascript within Selenium as like..<br/>
  You can directly execute javascript on a hidden element and set the attribute:</p>
  <pre><code>WebDriver driver;
  JavascriptExecutor js = (JavascriptExecutor) driver;
  js.executeScript(&quot;document.getElementById('auth_login_password').setAttribute('value', val );&quot;);
  driver.ExecuteScript(string.Format(&quot;document.getElementById('cred-password-inputtext').value='{0}';&quot;,password));
  </code></pre>
  <p>How do I modify to write out a java-script alert? If it was feasible, I would like to use it as a debug tool too.</p>