AppiumDotNet Driver - 3.0.0.2 error - System.IO.FIleNotFoundException


#1

Visual Studio for Mac
.net core 2.0
Appium.Webdriver - 3.0.0.2
Selenium.Webdriver - 3.0.1
Nunit3

using System;
using System.Threading;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Appium.Interfaces;
using OpenQA.Selenium.Appium.iOS;
using OpenQA.Selenium.Appium.PageObjects;
using OpenQA.Selenium.Appium.PageObjects.Attributes;
using OpenQA.Selenium.Appium.Service;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.PageObjects;

namespace OnMobile
{
public class Testing
{
    public static AppiumDriver<AppiumWebElement> driver;
    public static DesiredCapabilities cap;

    
    [FindsByIOSUIAutomation(XPath = "//XCUIElementTypeStaticText[@name='Action Sheets']")]
    public IWebElement TopOption;

    [Test]
    public void Testing1()
    {
       
        iOS_LaunchApp();
        AppiumPageObjectMemberDecorator decorator = new AppiumPageObjectMemberDecorator(new TimeOutDuration(System.TimeSpan.FromSeconds(15)));
        PageFactory.InitElements(driver, this, decorator);

        Thread.Sleep(3000);  
        TopOption.Click();
    }

    public static void iOS_LaunchApp()
    {
        cap = new DesiredCapabilities();
        cap.SetCapability("platformName", "iOS");
        cap.SetCapability("deviceName", "iPhone 7 Plus");
        //cap.SetCapability("fullReset", false);
        //cap.SetCapability("fullReset", true);
        cap.SetCapability("platformVersion", "11.2");
        cap.SetCapability("automationName", "XCUITest");       
        cap.SetCapability("app", "/Users/sunilkumarpatro/Desktop/UICatalog.app");
        //cap.SetCapability("noReset", true);
        driver = new IOSDriver<AppiumWebElement>(new Uri("http://127.0.0.1:4723/wd/hub"), cap);     
        Assert.IsNotNull(driver);
    }
}
}

and error I am getting on the line driver = new IOSDriver(new Uri(“http://127.0.0.1:4723/wd/hub”), cap);
as

System.IO.FileNotFoundException : Could not load file or assembly 'System.Security.Permissions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

   at OpenQA.Selenium.Appium.Service.AppiumCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Appium.AppiumDriver`1..ctor(Uri remoteAddress, ICapabilities desiredCapabilities)
   at OnBalanceMobile.Testing.iOS_LaunchApp() in /Users/sunilkumarpatro/Projects/OnMobile/OnMobile/Testing.cs:line 77
   at OnBalanceMobile.Testing.Testing1() in /Users/sunilkumarpatro/Projects/OnMobile/OnMobile/Testing.cs:line 37`Preformatted text`

#2

I’m having this same issue. Same versions for everything but running on Windows. I fixed it by installing the System.Security.Cryptography package in my main test project. I think they have a dependency on the DLL but don’t specify it as a package dependency. They probably expect it to be in the GAC or something.