Search code examples
javaselenium-webdriverintellij-ideaautoit

Selenium Webdriver + AutoIT + Java - Automate Windows Security Pop UP


I'm trying to automate an OS Dialog (Windows Security) with AutoIT

The imports are (Only the second one is being used)

import java.io.File;
import autoitx4java.AutoItX;
import com.jacob.com.LibraryLoader;

The code is:

AutoItX x = new AutoItX();
    x.winActivate("Windows Security");
    x.winWaitActive("Windows Security");
    Thread.sleep(3000);
    x.send("\'domain\\username\'");
    x.send("{TAB}");
    x.send("password");
    Thread.sleep(3000); 
    x.send("{ENTER}");

But it is not working for me. Can anybody help me?


Solution

  • I had to create an script with AutoIT, but when I write in Java the sentences:

     Runtime.getRuntime().exec("C:\\Folder\\script.exe");
    

    This doesn't work, because I need to call the exe with Admin grants.

    Does anybody know how to do that?

    Solution: Depending of the navigator, you can use the Runtime.getruntime. Chrome is able to use this, but IExplorer is not able to execute the sentence.