Got below exception when trying to work with Appium and WinAppDriver on Windows 10.
Message: Class Initialization method UIAutomation.ExcelScenario.ClassInitialize threw exception. OpenQA.Selenium.WebDriverArgumentException: OpenQA.Selenium.WebDriverArgumentException: Bad capabilities. Specify either app or appTopLevelWindow to create a session.
How cloud I solve this?
Environment
.NET framework 4.7.2.
Appium WebDriver version="5.0.0-beta01"
Windows 10 Enterprise
WinAppDriver v1.2.1
Castle.Core version="4.4.1"
DotNetSeleniumExtras.PageObjects version="3.11.0"
Newtonsoft.Json version="13.0.1"
Selenium.Support version="4.1.0"
Selenium.WebDriver version="4.1.0"
Code To Reproduce Issue [ Good To Have ]
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Windows;
using System;
namespace UIAutomation
{
public class ExcelSession
{
private const string WindowsApplicationDriverUrl = "http://127.0.0.1:4723";
private const string ExcelAppId = "Excel";
private const string sourceFileExcel = @"/e C:\tmp\Test.xlsx";
protected static WindowsDriver session;
public static void Setup(TestContext context)
{
if (session == null)
{
AppiumOptions appOptions = new AppiumOptions();
appOptions.App = ExcelAppId;
appOptions.DeviceName = "WindowsPC";
appOptions.AddAdditionalAppiumOption("appArguments", sourceFileExcel);
session = new WindowsDriver(new Uri(WindowsApplicationDriverUrl), appOptions);
Assert.IsNotNull(session);
session.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1.5);
}
}
public static void TearDown()
{
// Close the application and delete the session
if (session != null)
{
session.Quit();
session = null;
}
}
}
}
Description
Got below exception when trying to work with Appium and WinAppDriver on Windows 10.
How cloud I solve this?
Environment
Code To Reproduce Issue [ Good To Have ]
Exception stacktraces