Haha, thanks, ferruzoft. For the video you mentioned, I even bought his course on Udemy. The code I showed you is worked on his course but failed on mine…
AppiumServiceBuilder appiumServiceBuilder = new AppiumServiceBuilder()
.UsingAnyFreePort();
AppiumLocalService appiumLocalService = appiumServiceBuilder.Build();
if (!appiumLocalService.IsRunning)
appiumLocalService.Start();
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability("deviceName", "EM1");
capabilities.SetCapability("platformVersion", "6.0");
capabilities.SetCapability("platformName", "Android");
capabilities.SetCapability("appPackage", "com.thlonline.telme");
capabilities.SetCapability("appActivity", "com.thlonline.telme.MainActivity");
AndroidDriver<AndroidElement> androidDriver = new AndroidDriver<AndroidElement (appiumLocalService, capabilities);