1

I'm getting the following error when trying to run my selenium webdriver tests from a user control I have created: An exception of type 'System.TypeLoadException' occurred in UserCreationFrontEnd.exe but was not handled in user code

Additional information: Could not load type 'OpenQA.Selenium.Support.UI.WebDriverWait' from assembly 'WebDriver, Version=2.48.2.0, Culture=neutral, PublicKeyToken=null'.

Background story: I have created an app with some automated test suites in that allows people within my team without visual studio to run them. This app is a winforms app and is written in c# and uses user controls. I have added a user control into my selenium solution to run the selenium tests. When I run the user control from here the tests run as expected.

The issue appears when I add the user control into my main application and try and run the selenium tests from there.

The user control is displayed fine, but when I try to start the tests I get the error in my test start up (OneTimeSetUp).

Code:

        public void TestStartUp()
    {
        driver = new InternetExplorerDriver(@"O:\Testing\SDET\SeleniumWebDriver");
        wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
        config = new MapsPageObjectModel.EnvironmentConfig(driver);
        navBar = new MapsPageObjectModel.NavigationBar(driver);
        homePage = new MapsPageObjectModel.Homepage(driver);
        createContact = new MapsPageObjectModel.CreateContact(driver);
        securityManager = new MapsPageObjectModel.SecurityManager(driver);
        companyPage = new MapsPageObjectModel.Company(driver);
        createEmployee = new MapsPageObjectModel.CreateEmployee(driver);
        roles = new MapsPageObjectModel.Roles(driver);
        UserCreationResults.Clear();
    }

The error happens on this line

wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));

Does anyone have any idea's?

2 Answers 2

2

Go to Manage NuGet window and make sure you have installed same version of Selenium.Support and Selenium.WebDriver across all your projects in your solution.

Sign up to request clarification or add additional context in comments.

Comments

0

You need to have both usings in your .cs file:

using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;

Also u need to have refences to WebDriver and WebDriver.Support.

1 Comment

I've got the usings and the references added into my project but I'm still getting the error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.