Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.TypeLoadException: Could not load type 'OpenQA.Selenium.PhantomJS.PhantomJSDriver' from assembly 'WebDriver, Version=3.14.0.0, Culture=neutral, PublicKeyToken=null'. #189

Closed
empz opened this issue Sep 19, 2018 · 5 comments

Comments

@empz
Copy link

empz commented Sep 19, 2018

I've created a fresh new solution with only one MSTest project targetting .NET Framework 4.5.2.
Added the following packages:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Coypu" version="2.14.0" targetFramework="net452" />
  <package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net452" />
  <package id="MSTest.TestFramework" version="1.3.2" targetFramework="net452" />
  <package id="Selenium.Support" version="3.14.0" targetFramework="net452" />
  <package id="Selenium.WebDriver" version="3.14.0" targetFramework="net452" />
  <package id="Selenium.WebDriver.GeckoDriver.Win64" version="0.22.0" targetFramework="net452" />
</packages>

And a simple test method:

    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            var sessionConfiguration = new SessionConfiguration
            {
                AppHost = "jamstack.org",
                SSL = true,
                Driver = typeof(SeleniumWebDriver),
                Browser = Coypu.Drivers.Browser.Firefox
            };

            using (var browser = new BrowserSession(sessionConfiguration)) // throws exception
            {
                Assert.IsTrue(browser.HasContent("JAM"));
            }
        }
    }

I'm getting the following exception on the commented line:

System.TypeLoadException: Could not load type 'OpenQA.Selenium.PhantomJS.PhantomJSDriver' from assembly 'WebDriver, Version=3.14.0.0, Culture=neutral, PublicKeyToken=null'.

Why is it trying to load PhantomJS if I've explicitly told it to use Firefox?

@empz
Copy link
Author

empz commented Sep 19, 2018

I'm getting the same with the following code:

SessionConfiguration sessionConfiguration = new SessionConfiguration
            {
                AppHost = "localhost",
                Port = this.Port,
                SSL = false,
                Timeout = TimeSpan.FromSeconds(2),
                RetryInterval = TimeSpan.FromSeconds(0.1),
                WaitBeforeClick = TimeSpan.FromMilliseconds(0.2)
            };
sessionConfiguration.Driver = typeof(SeleniumWebDriver);
sessionConfiguration.Browser = Coypu.Drivers.Browser.InternetExplorer;

var browser = new BrowserSession(sessionConfiguration); // throws the exception on this line

@patcyg
Copy link

patcyg commented Oct 15, 2018

Seems like it is the issue with Selenium.WebDriver or Selenium.Support with version "3.14.0"
I downgraded both the packages to version "3.13.1" and it worked.

@obstar
Copy link
Collaborator

obstar commented Dec 7, 2018

@eparizzi coypu v2.14 doesn't support selenium webdriver v3.14.0 - they remove it PhantomJS in that version.
Also coypu v2.14 is compiled against selenium webdriver 3.3.0 so thats why you get these weird behaviour (coypu selenium v3.3.0 vs project selenium v3.14.0).

There will be soon a new release of coypu supporting fully selenium webdriver v3.14

@obstar
Copy link
Collaborator

obstar commented Dec 8, 2018

#191 fix will be available with next release

@obstar obstar added this to the Coypu 3 milestone Dec 9, 2018
@obstar
Copy link
Collaborator

obstar commented Dec 11, 2018

Coypu 3.0.0-rc has been released https://github.com/featurist/coypu/releases/tag/3.0.0-rc

@obstar obstar closed this as completed Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants