I have some Selenium test cases which were written in Windows. Now I want to run them in Ubuntu. I found a way to link my C# program and selenium dll using this solution, but I'm getting the following error:

Unhandled Exception: System.IO.FileNotFoundException:   
Could not load file or assembly 'WebDriver, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies.   
File name: 'WebDriver, Version=, Culture=neutral,   
Could not load file or assembly 'WebDriver, Version=, Culture=neutral, PublicKeyToken=nullure=neutral, PublicKeyToken=null


using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

namespace SelTest {
    class TestOne {
        public static void Main(string[] args) {
            IWebDriver driver = new ChromeDriver();

Command used for compiling and running:

mcs -r:/home/local/prasanth/test/dist/lib/net45/WebDriver.dll SelTest.cs; ./SelTest.exe

My mono version:

The selenium library was downloaded from here.


This is finally solved by setting the MONO_PATH environmental variable in my .bashrc file.

The documentation says:

At run time, Mono looks in three places for assemblies necessary to run a program. It first searches the location of the executing assembly. If your application uses assemblies not provided by the runtime, you may place them all in the same directory so that Mono may find them. If a required assembly isn’t found there, Mono searches the MONO_PATH environment variable.

In my .bashrc: export MONO_PATH=/home/local/prasanth/test/dist/lib/net45/

I added this line and compiled my .bashrc file. Now my application runs without any problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.