Take the 2-minute tour ×

When I activate a url via Webdrive that start up a Word Document a dialogbox with a Yes or No is started up . How do I send in keys to click the Yes-button in Webdrive.

share|improve this question
Not enough information. How have you got WebDriver, which is used to automate Web Browsers, talking to MS Word? –  bmargulies Aug 19 '12 at 20:19
I am using following code to extract the attribute and activating the URL. for (WebElement e : list) { if (value.equals(e.getAttribute("value"))) { e.click(); break; } –  user1610446 Aug 20 '12 at 6:11
add comment

1 Answer

First you need to switch to the particular window using the following method -


If the name is not known, you can use




If it's JavaScript you can use -

// Get a handle to the open alert, prompt or confirmation
Alert alert = driver.switchTo().alert();
// Get the text of the alert or prompt
// And acknowledge the alert (equivalent to clicking "OK")

Hope this helps!

share|improve this answer
Since it is not a Browser window I switch to, but a Word Dialogbox in which I have to click the YES button. How do send in a key to press Yes-button. –  user1610446 Aug 21 '12 at 7:25
If its not a browser then I am sorry Selenium cannot help you in that. You may like to use some desktop application automation tools like QTP or WindowTester! –  Maitreya Aug 21 '12 at 7:31
add comment

Your Answer


