Window application starts from .bat file
Hi, The application starts from .bat file, but the login screen is created in SWT_window0. I want to click in "User: " field and type login, then, "Password: " and type password but instead of it I receive and error. The error according to me appears because the session is assigned to cmd wind (created by .bat file) and I can't catch the splash screen.
Could you please tell me how can I get splash screen and assign to the new session? I should I make it in different way?
My code:
WindowsDriver
application = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), desiredCapabilities);
Thread.Sleep(20000);
// LeftClick on Edit "User: " at (90,2)
Console.WriteLine("LeftClick on Edit \"User: \" at (90,2)");
var winElem_LeftClickEditUser_90_2 = application.FindElementByName("User: ");
if (winElem_LeftClickEditUser_90_2 != null)
{
winElem_LeftClickEditUser_90_2.Click();
}
else
{
Console.WriteLine($"Failed to find element using xpath: User");
return;
}
Error:
OpenQA.Selenium.WebDriverException
HResult=0x80131500
Message=An element could not be located on the page using the given search parameters.
Source=WebDriver
StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters)
at OpenQA.Selenium.Appium.AppiumDriver1.Execute(String driverCommandToExecute, Dictionary2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
at OpenQA.Selenium.Appium.AppiumDriver1.FindElementByName(String name)
at ConsoleApp2.Program.Main(String[] args) in C:\Users\zelazop\source\repos\ConsoleApp2\Program.cs:line 53
A better option will be to start the batch file programatically and then create a desktop session as root and switch to the top level window.
@anunay1 for now, it works as you wrote :) Thank you.