Open jheidlage1222 opened 7 years ago
I just wanted to corroborate what @jheidlage1222 said and highlight this as is an jarring experience to what should be a common use case: new xUnit Project (.Net Core) -> install Selenium.WebDriver via NuGet -> build successfully (with warnings) -> runtime error
I highly suggest referencing the latest stable version which is 4.4.0 (https://www.nuget.org/packages/System.Security.Permissions/4.4.0). That should eliminate the warning.
This is more a note than an issue, I just figured others might see and be helped .NET Core 2.0 was officially released a few days ago so I installed it along with VS 2017 Version 15.3.0 (Lastest.) I created a netcore2.0 console project and added the nuget packages for Selenium.WebDriver (V. 3.4.x) and Selenium.Chrome.WebDriver (2.30.0.) Before I get to my primary issue, I had to do the following before I encountered the Security issue.
The WebDriver pkg is just the ChromeDriver.exe file being copied to your output folder so you don't need to download it externally and place it in your path. For reasons I don't fully understand, it does copy it to the bin\Debug\netcoreapp2.0 location when you Build the project but the Current Directory/Working directory does not resolve to the same location so you have to point to that location when instantiating your IWebDriver/ChromeDriver.
This finally led me to the System.Security.Permissions issue being thrown when instantiating ChromeDriver. By the looks of things, rather than use the netcore2.0 System.Security.dll it was using the dll from .net 4.6.1. I fixed this by manually editing my .csproj file and adding the highlighted line (your .csproj file has the same, I believe.)
Saving, re-opening the sln in VS and doing a Clean/Rebuild generated the following highlighted warning
So it didn't load the dll I told it to but this seems to have jogged it to grab a compatible version as I ran the console app and was able to instantiate and work with ChromeDriver. Hopefully this helps someone else.