I am trying to setup & run appium (desktop OR CLI) via VisualStudio (C#) and i’m getting this error:
Appium Log:
[Appium] Appium v1.18.2 creating new AndroidUiautomator2Driver (v1.56.1) session
[debug] [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {
[debug] [BaseDriver] “alwaysMatch”: {
[debug] [BaseDriver] “appium:UIAutomator2”: “Android”,
[debug] [BaseDriver] “appium:deviceName”: “Pixel 3a”,
[debug] [BaseDriver] “appium:app”: “C:\Users\Yaniv\MMApp.apk”,
[debug] [BaseDriver] “appium:chromedriverExecutable”: “C:\TestLogs\chromedriver.exe”,
[debug] [BaseDriver] “platformName”: “Android”
[debug] [BaseDriver] },
[debug] [BaseDriver] “firstMatch”: [
[debug] [BaseDriver] {}
[debug] [BaseDriver] ]
[debug] [BaseDriver] }
[BaseDriver] The following capabilities were provided, but are not recognized by Appium:
[BaseDriver] UIAutomator2
[BaseDriver] Session created with session id: ce300ce7-ebeb-4cc9-9421-a0e0aa896993
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [BaseDriver] Event ‘newSessionStarted’ logged at 1601791967183 (09:12:47 GMT+0300 (Israel Daylight Time))
[debug] [W3C] Encountered internal error running command: Error: The application at ‘C:\Users\Yaniv\MMApp.apk’ does not exist or is not accessible
[debug] [W3C] at C:\Users\Yaniv\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\basedriver\helpers.js:235:13
[debug] [W3C] Destroying socket connection
[HTTP] <-- POST /wd/hub/session 500 445 ms - 735
[HTTP]
The apk path: ‘C:\Users\Yaniv\MMApp.apk’ is exist for 100% because if i’m running appium desktop without VS - it identifies the file. Also tested with file location- copy&paste leads to the apk.
Can anyone help me with this?
My code in VS:
` public void Setup()
{
var appPath = @“C:\Users\Yaniv\MMApp.apk”;
var driverOptions = new AppiumOptions();
driverOptions.AddAdditionalCapability(AutomationName.AndroidUIAutomator2, "Android");
driverOptions.AddAdditionalCapability(MobileCapabilityType.PlatformName, "Android");
driverOptions.AddAdditionalCapability(MobileCapabilityType.DeviceName, "Pixel 3a");
driverOptions.AddAdditionalCapability(MobileCapabilityType.App, appPath);
driverOptions.AddAdditionalCapability("chromedriverExecutable", @"C:\TestLogs\chromedriver.exe");
_driver = new AndroidDriver<AndroidElement>(new Uri("http://localhost:4723/wd/hub"), driverOptions);
_driver.FindElementByXPath("//android.widget.TextView[@text='User Name']").Click();
}`