Having the tests open the WPF Application
See original GitHub issueI am trying to use Appium to test my WPF application using automation, and I am running into an interesting error. I can get everything working fine if the app is already opened when I got to run the tests and everything passes, but something that I would like for it to do is to open the app when I start the test. The setup method that is run at the beginning of the test looks like this:
public static void Setup(TestContext context)
{
// Sets up the session so that testing can be done on the application
if (session == null)
{
// Create a new session to bring up an instance of the app
var capabilities = new AppiumOptions();
capabilities.AddAdditionalCapability("app", AppId);
capabilities.AddAdditionalCapability("platformName", "Windows");
capabilities.AddAdditionalCapability("deviceName", "WindowsPC");
session = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), capabilities);
Assert.IsNotNull(session);
Assert.IsNotNull(session.SessionId);
// Set implicit timeout to 1.5 seconds to make element search to retry every 500 ms for at most 3 times(??)
session.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1.5);
}
}
And again, when I go to run the test, if the application is not open, I get the following exception: OpenQA.Selenium.WebDriverException: OpenQA.Selenium.WebDriverException: Failed to locate opened application window with appId: AppId, and processId: 26896
Is there any way to make is so that you can fix this so that the tests will open the application instead?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top GitHub Comments
I was doing a bit more looking and I found this stackoverflow question that fixed the issue. For whatever reason I just had to set the working directory to the path of the WPF app. But this is solved now!
https://stackoverflow.com/questions/19969693/launch-wpf-application-using-process-start
What you are doing is correct. As I also do the same way what you are doing, but if the application does not even start with Process.Start that that is a problem with you application, we can have a hangout call(I am available now)anunayathakur1@gmail.com