question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Appium Dotnet 5.0.0-beta01: Cannot instantiate WIndowsDriver: AppiumOptions "Vendor Prefix" causing driver instantiation error

See original GitHub issue

I was trying out the Appium 5.0.0 Beta01. My capabilities/options looked like this:

            var options = new AppiumOptions();
            options.AddAdditionalCapability("app", "root");
            options.AddAdditionalCapability("ms:experimental-webdriver", true);

            WindowsDriver driver = new WindowsDriver(new Uri(WinAppDriverUrl), options, TimeSpan.FromSeconds(60));

but this set of options, specifically the option for (“app”, "root), threw this error: There is already an option for the appium:app capability. Please use the Application property instead. Parameter name: capabilityName

so I replaced it with this property instead: options.App = "root"; which apparently passes the capability as (“appiumoption:app”,“root”) instead of the old (“app”, “root”) key-value pair. and so now I get this errorr: OpenQA.Selenium.WebDriverArgumentException: Bad capabilities. Specify either app or appTopLevelWindow to create a session

I looked into the Appium dotnet source code and looks like the AppiumOptions class’s method to create a new AppiumOption has been modified: AppiumOptions.cs diff: Appium 4.3.1 vs 5.0.0 Beta01 This method in particular seems to have brought the change, adding a vendor prefix before any and all additional options/capabilities:

public void AddAdditionalAppiumOption(string optionName, object optionValue)
        {
            string name = optionName.Contains(":") ? optionName : $"{VendorPrefix}:{optionName}";
            this.ValidateCapabilityName(name);
            this.additionalAppiumOptions[name] = optionValue;
        }

I couldn’t find any way to get around it. Here’s a ticket for this issue in the Appium Dotnet Repo: https://github.com/appium/appium-dotnet-driver/issues/487

@kat-y @DHowett Is this being taken care of for the next release? This is a blocker on the upgrade path to Selenium 4 and Appium 5.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:22

github_iconTop GitHub Comments

1reaction
cernyjancommented, Mar 18, 2022

Hi all, I am stuck as well. My test stopped working previous week on this error:

System.TypeLoadException : Access is denied: 'OpenQA.Selenium.Remote.DesiredCapabilities'.

So I have started to solve it, I have tried perhaps all possibility combinations:

  • Update Appium.WebDriver (Nuget package in C# project) from 4.3.1 to 5.0b
    • there were described problem above (“Bad capabilities. Specify either app or appTopLevelWindow to create a session”)
  • Downgrade Appium.WebDriver into lower version (e.g. 4.0) with Selenium 3.141
    • there were problem, that Appium still uses 4.x Selenium version, probably due to another project in Solution, which uses higher Selenium
  • Link Appium.WebDriver as a standalone project into Solution without Nuget
    • the same problem, higher Selenium has been used
  • Remove Nuget of Appium.WebDriver and starting own Appium server as described above (http://127.0.0.1:4725/wd/hub)
    • problem with starting of application and WinAppDriver has been solved
    • but there were new problem, Finding elements stop working and new one (MobileBy.Name) works only for Notepad example, but not for my application
0reactions
sramdas2commented, Oct 12, 2022

@pradeipp , did you get your issue resolved? I am using VS 2022 Pro and new to Appium/WinAppDriver. I am following a tutorial on launching notepad.exe using WinAppDriver. This line of code fails:

image

Can you please help?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot instantiate the type AppiumDriver - Support
If i run my project via Ant everything works fine. The error only occurs when trying to run the project from Eclipse. This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found