Desired capabilities obselete


#1

Hi

See below code , since updating project to latest appium and selenium , getting that DesiredCapabilities is obsolete in favour of Options, how would I change below to fix all the errors, have tried a few different options to cannot find the answer, please help

DesiredCapabilities cap = new DesiredCapabilities();
cap.SetCapability(“deviceName”, “Galaxy J3”);
cap.SetCapability(“platformVersion”, “5.1.1”);
cap.SetCapability(“platformName”, “Android”);
cap.SetCapability(“appPackage”, “com.softworks.selfservice.app”);
cap.SetCapability(“appActivity”, “com.softworks.selfservice.app.MainActivity”);
//cap.SetCapability(“useLocationServices”, true);
cap.SetCapability(MobileCapabilityType.NewCommandTimeout, 150000);

        cap.SetCapability("automationName", "UiAutomator2");

driver = new AndroidDriver(new Uri(“http://127.0.0.1:4723/wd/hub”), cap);


#2

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, “Galaxy J3”);
cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, “5.1.1”);
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, “Android”);
cap.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, “com.softworks.selfservice.app”);
cap.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, “com.softworks.selfservice.app.MainActivity”);
cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 150000);
cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, “UiAutomator2”);
new AndroidDriver<>(new URL(“http://127.0.0.1:4723/wd/hub”), cap);