How to bypass a splash screen when testing a Windows App?

Hello,
I am a new to Appium and still learning.
I was tasked to write test automation scripts in C# (Visual Studio 2019) to test a Windows application.

When I start this Windows app, the splash screen comes up first and then the main screen is displayed (in about 20-25 seconds).
The problem appears with the finding of UI elements. I use inspect.exe to find the elements’ properties but even the obvious elements (with FindElementByName) can not be found.
I suspect that Appium grabs the splash screen and treats it as the main screen and mistakenly tries to find the elements there (unsuccessfully, of course).
I think so because I also run Appium desktop application and Appium Inspector also stuck displaying the splash screen and does not go to the main screen.

In Visual Studio, I’ve tried to introduce a delay in the test execution to wait for a main screen with
Thread.Sleep(TimeSpan.FromSeconds(25)); //variable from 15 to 40 seconds
However, it did not resolve the issue.
I would appreciate any help on how to bypass the splash screen.

After struggling with this issue, it seems I eventually found the solution.
Initially, I was trying to get rid of splash screen in my application so that the main screen will be displayed first and Appium WinApp driver can start working on the screen.

Even though developers have removed the splash screen, for whatever reason, Visual Studio failed finding the running application window (the message was: “Failed to locate opened application window with appId”).
So, I returned the splash screen back and added couple lines of code to my script so that it is forced to re-focus and switch to the main application’ window. I found this code in here.
After updating, my code looks like this:

public void TestMethod1()
{
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.SetCapability(“app”, @“C:\PathToYourApp\YourApp.exe”);
desiredCapabilities.SetCapability(“deviceName”, “WindowsPC”);

var session = new RemoteWebDriver(new Uri(“http://127.0.0.1:4723”), desiredCapabilities);
Assert.IsNotNull(session);
//var currentWindowHandle = session.CurrentWindowHandle; //This piece seems to be unnecessary
//My app requires a long start up time of 20s or so. Here is the pause.
Thread.Sleep(TimeSpan.FromSeconds(20));

//Re-focus on the main screen of my application
var allWindowHandles = session.WindowHandles;
session.SwitchTo().Window(allWindowHandles[0]);

//In 3 lines below, I am closing my application and had to re-focus again
//on the small pop-up screen and click OK to confirm the exit.
session.FindElementByName(“Close”).Click();
session.SwitchTo().Window(allWindowHandles[0]);
session.FindElementByName(“OK”).Click();
}

Hi Everyone,

After 2 sleepless nights I was able to find the solution to the issue related to Splash Screen being stuck and not going to the second screen using script/appium but manually it was working fine.
The issue is something related to INTENT Activity
Solution:
I added some extra line of code to script/capabilities to appium and it worked fine.
Try using these lines in capabilities for the apps that have splash screen issue.

capabilities.setCapability(“androidCoverage”,“com.my.Pkg/com.my.Pkg.instrumentation.MyInstrumentation”);
capabilities.setCapability(“androidCoverageEndIntent”,“com.example.pkg.END_EMMA”);
capabilities.setCapability(“intentAction”,“android.intent.action.MAIN”);
capabilities.setCapability(“intentCategory”,“android.intent.category.LAUNCHER”);
capabilities.setCapability(“intentFlags”,“0x10200000”);

Please Let me know if it worked for you also?

Do you know how i would get the ‘intent’ information for Windows Applications, such as notepad etc…