WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

Failed to located opened application window with app id C:\Windows\System32\cmd.exe and Process Id:22300

Open rabia08 opened this issue 4 years ago • 4 comments

Hi, I want to open a command prompt and apply some operations but the win app driver shows me this error. I am using Eclipse 2021-09. I apply all solutions but this error comes again and again. my code: package WinAppDriver.WinAppDriver;

import java.io.IOException; import java.net.MalformedURLException; import java.net.URL;

//import org.openqa.selenium.By; //import org.openqa.selenium.Keys; import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.windows.WindowsDriver; import io.appium.java_client.windows.WindowsElement;

public class Randm {

public static void main(String[] args) throws InterruptedException, IOException {
	
	
	DesiredCapabilities cap = new DesiredCapabilities();
	
	
	
	cap.setCapability("app", "C:\\Windows\\system32\\cmd.exe");

	WindowsDriver<WindowsElement> driver = new WindowsDriver<WindowsElement>(new URL("http://127.0.0.1:4723/"),cap);

	cap.setCapability("appArguments", "/c SCHTASKS.EXE /RUN /TN \\\\iVMSTASK\\\\ivmsopen");
	//driver.findElement(By.name("Text Area")).sendKeys("SCHTASKS.EXE /RUN /TN \\iVMSTASK\\ivmsopen");
	//driver.getKeyboard().sendKeys(Keys.ENTER);

	Thread.sleep(15000);

	driver.quit();
	
	
}

}

rabia08 avatar Oct 08 '21 04:10 rabia08

@rabia08 can you explain what is happening, does the app even launch? Is this an intermittent issue?

Also, why are you using WinAppDriver to interact with cmd line? You could execute "SCHTASKS.EXE /RUN /TN \iVMSTASK\ivmsopen" programmatically without having to even use WinAppDriver. Just create a batch file and execute in code. See an example like this (C#) https://stackoverflow.com/questions/5519328/executing-batch-file-in-c-sharp

Tree55Topz avatar Oct 08 '21 20:10 Tree55Topz

@Tree55Topz @anunay1 : Can you please update us here . I am facing similiar issue

LisaAga avatar Jun 29 '22 08:06 LisaAga

@rabia08 : were you able to solve this?

LisaAga avatar Jun 29 '22 08:06 LisaAga

@LisaAga As @Tree55Topz mentioned WinAppDriver is not the right tool for such cases, do it programmatically.

Shakevg avatar Jul 02 '22 13:07 Shakevg