Selenium: WebDriver - System.TypeLoadException is not handled every time I run the most basic project

Error Details:

System.TypeLoadException fix was unhandled
HResult = -2146233054
Message = Failed to load type 'OpenQA.Selenium.Firefox.FirefoxDriver' from assembly
> 'WebDriver, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = null'.
Source = WebDriver
TypeName = OpenQA.Selenium.Firefox.FirefoxDriver
Stacktrace:
on Driver.Main (String [] args)
in System.AppDomain._nExecuteAssembly (assembly RuntimeAssembly, String [] args)
in System.AppDomain.ExecuteAssembly (String assemblyFile, Evidence
assemblySecurity, String [] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly ()
in System.Threading.ThreadHelper.ThreadStart_Context (object state)
in System.Threading.ExecutionContext.RunInternal (ExecutionContext
> executeContext, ContextCallback callback, object state, logical save (SyncCtx)
in System.Threading.ExecutionContext.Run (ExecutionContext executeContext,
> ContextCallback callback, Object state, Boolean preserveSyncCtx)
in System.Threading.ExecutionContext.Run (Execution Context Execution Context,
> ContextCallback callback, Object state) in System.Threading.ThreadHelper.ThreadStart ()
InnerException:

I am running Visual C # 2010 on Windows 8. I changed the target structure to .Net framework 4 (from .Net Framework 4 Client Profile). I tried three big browsers:

//IWebDriver driver = new FirefoxDriver(); //IWebDriver driver = new ChromeDriver(); IWebDriver driver = new OpenQA.Selenium.IE.InternetExplorerDriver(); 

The same error every time (in principle, anyway). The code is derived from their documents: http://docs.seleniumhq.org/docs/03_webdriver.jsp#introducing-the-selenium-webdriver-api-by-example

Any help would be greatly appreciated. Just starting with Selenium, hoping to automate a few simple tasks to get started. If I find out before receiving a response, I will send it as an update.

Edit: I tried to clean the formatting a bit.

0
firefox selenium-webdriver typeloadexception
source share
1 answer

This error occurred due to the fact that I tried to compile a new project based on Selenium before adding links. After I understood the error, I added links to all the assemblies and still got the error. It turns out that Visual Studio was "stuck", as I now know, this is not uncommon. A quick restart of the IDE was all necessary.

0
source share

All Articles