WinAppDriver
WinAppDriver copied to clipboard
Executing a .bat that internally executes another .bat
I just started using WinAppDriver and I have a problem with starting my desktop application in a Selenium-WindowsAppDriver project that I created from scratch.
Let's first explain how I start the app manually. I run the application.bat, which calls the fonts.bat and after that the login screen shows.
Now, I wrote a simple jUnit test in which I'm searching for a element but that is irrelevant now. The problem is that I get an error in the console saying "'fonts.bat' is not recognized as an internal or external command, operable program or batch file."
Can someone help me? i included a picture of the project folder with the .bat files. I was trying with running intelij as admin, there is no difference.
Is it maybe better to open the app not using the WinAppDriver ? But then, I don't know how would I get the driver to recognize the application.
Here is the code:
public class GlavniIzbornikPage {
private static WindowsDriver driver = null;
@BeforeClass
public static void setUp() {
try {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("app", "C:\\ppcfg\\application.bat");
capabilities.setCapability("platformName","Windows");
capabilities.setCapability("deviceName", "WindowsPC");
driver = new WindowsDriver(new URL("http://127.0.0.1:4723"), capabilities);
driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void klik() throws InterruptedException {
driver.findElementByName("name");
}
@AfterMethod
public void cleanApp(){
driver.quit();
}
anthony11c Try the next better approach:
- Run bat from code anthony11c
- connect to program using process name or app title https://github.com/microsoft/WinAppDriver/issues/1578#issuecomment-905453842 https://github.com/microsoft/WinAppDriver/issues/534#issuecomment-562030077