Open sparticus1701 opened 1 year ago
Can you post any code?
The code is on the Stack Overflow post, but here it is as well.
Why are you creating two sessions?
_appSessionWindowsDriver = new WindowsDriver
AppiumOptions desktopSessionAppiumOptions = new AppiumOptions();
desktopSessionAppiumOptions.AddAdditionalCapability("app", "Root");
desktopSessionAppiumOptions.AddAdditionalCapability("deviceName", DeviceName);
_desktopSessionWindowsDriver = new WindowsDriver<WindowsElement>(new Uri(AppiumDriverURI), desktopSessionAppiumOptions);
All this is detailed in the Stack Overflow post. I'm trying to set up automated testing on my net48 WPF app following the methods found in this article: https://www.telerik.com/blogs/get-your-wpf-apps-automated-appium.
Does you application require interactions with other opened apps? Because the above link that you shared it uses the desktop session to interact with other apps.
No, it does not.
No, it does not.
Then why do you require two sessions.
I was simply following the article trying to get something to work. However, taking the other session out does not fix the problem.
the error says:
OpenQA.Selenium.WebDriverException
HResult=0x80131500
Message=Object reference not set to an instance of an object.
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.AppiumDriver
1.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) at OpenQA.Selenium.Appium.AppiumDriver
1..ctor(Uri remoteAddress, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.Windows.WindowsDriver`1..ctor(Uri remoteAddress, AppiumOptions AppiumOptions)
at Automation.Tests.TestInitialize()
it's in initialize function, try to put up a breakpoint and check which line throws the error.
if you need any support send a teams invite.
You're not understanding the problem. The problem I'm seeing is that on my computer, WinAppDriver is launching my application to be tested twice, and it doesn't happen on other computers. Even when I rip out the desktop session from the article (attached), it still occurs.
When the test finishes, one of the two launched instances remains. AutomationTest.zip
I had issues recently with this whilst trying to test stuff. I've found adding the Capability "ms:waitForAppLaunch", 10 stops it from happening most of the time, may need to adjust but 10 seems to be the sweet spot for mine. I think the WinAppDriver/Selenium thinks it's not loaded so it retries it. Though when I had the issue it would still test the application as long as the splash screen wasn't over the actualy window.
Not sure if you are still having the issue but thought I'd at least throw this here if anyone else is potentially having issues like this and is looking for some kind of solution.
I posted this topic to StackOverflow but there has not been any response:
https://stackoverflow.com/questions/75688172/problems-launching-automated-tests-with-appium-webdriver-winappdriver-on-wpf
In my test (posted there), it appears to launch two instances of the app. Others who use the same app do not see that behavior, so there must be something different about my computer but I have no idea where to look.