I am writing a first test in Appium using AndroidDriver with C#. When I write this line
driver = new AndroidDriver<AndroidElement>(url, options);
I get the error:
OpenQA.Selenium.WebDriverException: 'The capabilities ["PlatformName"] are standard capabilities and
should not have the "appium" prefix'
My code snippet is:
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using NUnit.Framework;
using OpenQA.Selenium.Appium;
namespace AppiumCTest1
{
[TestClass]
public class TC1
{
AndroidDriver<AndroidElement> driver;
DesiredCapabilities cap;
[TestMethod]
public void TestBrowser()
{
AndroidDriver<AndroidElement> driver;
AppiumOptions options = new AppiumOptions();
options.PlatformName = "Android";
options.AddAdditionalCapability("deviceName", "Pixel API 29");
options.AddAdditionalCapability("PlatformName", "Android");
options.AddAdditionalCapability("Udid", "169.254.138.177:5555");
options.AddAdditionalCapability("fullRest", "True");
options.AddAdditionalCapability("appPackage", "MyPackage");
options.AddAdditionalCapability("appActivity", "MyActivity");
Uri url = new Uri("http://127.0.0.1:4723/wd/hub");
driver = new AndroidDriver<AndroidElement>(url, options);
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
driver.Navigate().GoToUrl("http://www.bing.com");
}
}
}
Some help appreciated to solve this issue. Thanks