1
votes

I am writing Selenium scripts to test my webpage. To simulate testing, a desktop application resets the date in the DB (as the actual process is run after the date changes).

Now I am able to call my application and click the button through Selenium by Runtime.getRuntime().exec("E:\\AutoIT\\DBReset.exe");, but I am unable to return the control to Selenium after the reset is done.

1
See: How do I do X? The expectation on SO is that the user asking a question not only does research to answer their own question but also shares that research, code attempts, and results. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer! See also: How to Ask - JeffC

1 Answers

2
votes

When you perform the operation by AutoIt using:

Runtime.getRuntime().exec("E:\AutoIT\DBReset.exe");

Selenium still holds the focus to the web page. So once the Windows dialog box closes, Selenium should be able to execute the next line of code.

In case Selenium complains of lost focus you can use JavascriptExecutor to gain back browser focus :

  • Java :

    ((JavascriptExecutor) driver).executeScript("window.focus();");