简体   繁体   中英

Getting Unhandled exception error: System.IO.FileNotFoundException:

i'm getting an error when trying to use Selenium w/ c#. I did use selenium yesterday and I had 0 problems. And was wondering what could cause this.

The error

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'WebDriver, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
   at ConsoleApplication1.Program.Main(String[] args)

What I do to recreate the error

  public static void Main(string[] args)
    {
        IWebDriver driver2 = new ChromeDriver();
        driver2.Navigate().GoToUrl("https://google.com")

    }

The Webdriver.dll is missing.

The first thing I suggest you to check is the binaries output folder (for example bin/debug folder, which you can check from your visual studio project settings). You will find all your referenced dlls and your project itself in this folder. It is likely that your Webdriver.dll is not being copied to the output folder. This usually happens when you add an external reference (dll) by using the "Add Reference" visual studio dialog box. To fix the issue, click on the Webdriver dll reference, and in the properties window, make sure to set copylocal = true .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM