title: C# Selenium Webdriver JavaScriptExecutor Prompt Window
body: <p>I have a JavaScript Prompt Window which I am trying to handle. I had one previously that was simply contained an 'OK' and 'Cancel' which I was able to handle with </p>
  
  <pre><code>((IJavaScriptExecutor)ts.getDriver()).ExecuteScript("window.confirm = function(){return true; }")
  </code></pre>
  
  <p>However now I have another prompt message but this time it requires me to send text to the prompt message and then hit 'OK'. I am not real familiar with javascript and the syntax can anyone supply the syntax to hand sending the text to the prompt box?</p>
  
  <p>UPDATE: The application I am trying to automate has generated a Windows Prompt. In the past I have handled most of the alert pop ups with </p>
  
  <pre><code>.SwitchTo().Alert().Accept();   
  </code></pre>
  
  <p>However this particular Windows Prompt (Please see image example)</p>
  
  <p><a href="https://i.stack.imgur.com/EuaQS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EuaQS.png" alt="enter image description here"></a></p>
  
  <p>cannot be captured this way hence my use of JavaScript to handle the window Pop Up. The reason I referenced the first section of code at the top was because this particular piece of code I used to handle the first Window Prompt. The difference being this time the Windows Prompt Box has an 'OK' Button, a 'Cancel' Button AND a text box in it which I must enter some sort of text to close the prompt box. All I am trying to find out is what syntax am I using to handle sending text into this Windows prompt for example:</p>
  
  <pre><code>((IJavaScriptExecutor)ts.getDriver()).ExecuteScript("window.confirm = function(){return true; }");
  </code></pre>
  
  <p>was used to close out the 'OK' prompt message but for a prompt box with text what should I be writing inside of the ExecuteScript</p>
  
  <pre><code>((IJavaScriptExecutor)ts.getDriver()).ExecuteScript("???");
  </code></pre>
  
  <p>So basically what script should I be writing where the question marks are. </p>