Return control to Selenium after executing an AutoIt script

随声附和 提交于 2019-12-13 09:12:30

问题


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:


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();");
    


来源:https://stackoverflow.com/questions/48477080/return-control-to-selenium-after-executing-an-autoit-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!