2

I'm working in multiple browser testing. It was working code with chrome browser. Recently I have installed "Install-Package Selenium.WebDriver -Version 4.0.0-alpha04".

MSedge Chromium and chrome working in setup method, But while navigate/return back to actual [Test] test method encountered the below error.

Error:Message: System.TypeLoadException : Could not load type 'OpenQA.Selenium.Internal.IWrapsElement' from assembly 'WebDriver, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'

Is this dll/package confused

[SetUp]
public void Setup()
{
   string Browsername = "Chrome";
   switch (Browsername)
   {
      case "Chrome":
      driver = new ChromeDriver();
   }
}

[Test]
[Obsolete]
public void XXXX()
{
    try
    {
       driver.Navigate().GoToUrl(UrlList.XXXX_Login);
       driver.Manage().Timeouts().ImplicitWait (TimeSpan.FromSeconds(200));
       driver.Manage().Window.Maximize();
       Login login = new Login(driver);
       login.PerformLogin(Login.email_id1, Login.pswd1);
    }
}
        
0

I encountered the same error.

I had to uninstall (WebDriver -Version 4.0.0-alpha04) and reinstall the Selenium.Support and Selenium.WebDriver.

The problem is resolved with Selenium Support 3.141.0 and Selenium WebDriver 3.141.0.

0

I think you need to double check the usings and recompile. OpenQA.Selenium.Internal should be OpenQA.Selenium. You are trying to call a moved interface.

Per v4.0.0a1 in https://github.com/SeleniumHQ/selenium/blob/master/dotnet/CHANGELOG "Moved IWrapsDriver and IWrapsElement from the OpenQA.Selenium.Internal namespace to the OpenQA.Selenium namespace. This should be a no-op for the vast majority of users, requiring only a recompile of code, given that both of these interfaces feature return types in the base namespace, meaning that users likely already have "using" statements for the root namespace in their source. If errors are encountered, changing the namespace in the code and rebuilding should resolve the error."

Source: IWrapsElement Error on Protractor 0.12.0 and Selenium.WebDriver 4.0.0-alpha01 #82

6
  • I checked in my code, i haven't use the OpenQA.Selenium.Internal used only OpenQA.Selenium. I have removed the the namespace NUnit.Framework.Internal also. Mar 3 '20 at 12:52
  • Maybe another library is using it? Mar 3 '20 at 13:33
  • after uninstallation of "Install-Package Selenium.WebDriver -Version 4.0.0-alpha04" its working, shall i try alpha03 version? Mar 3 '20 at 14:17
  • 1
    Dont you have a stack-trace? There is some line of code that is triggering this, you want to know which one. Mar 3 '20 at 15:20
  • In pagefactory getting error, in call stack got the error message like ((OpenQA.Selenium.Remote.RemoteWebDriver)driver).ApplicationCache = '((OpenQA.Selenium.Remote.RemoteWebDriver)driver).ApplicationCache' threw an exception of type 'System.InvalidOperationException' Mar 3 '20 at 16:08

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.