Search code examples
asp.netunit-testingwebdriverie-developer-tools

IE WebDriver as a UnitTest Project with a MVC 4 Solution not working


New to Unit testing so please, forgive my naiveness. Browsing through the code provided by the IE Developer Channel. I adopted the code into my MVC project by adding a Unit Test project. On debugging the test I write using the WebDriver API. The first step creating a session using the Command

const string newSessionCommand = @"
        {
            ""command"": {
                ""name"": ""newSession"",
                ""parameters"": {
                    ""desiredCapabilities"": {},
                    ""requiredCapabilities"": {}
                },
                ""sessionId"": null
            }
        }";

response = ExecuteCommand(newSessionCommand, null);

The command fails with the error "WebDriver will only run against the DeveloperPreview build. Please run this EXE with the following argument", compared the sample, added all that is needed like the x64 architecture, registering the dll, NOTE that is works in the BING search sample sln, but NOT as a test case, also added to the debug the command line arguments:

/appvve:9BD02EED-6C11-4FF0-8A3E-0B4733EE86A1_6A0357B5-AB99-4856-8A59-CF2C38579E78

Solution

  • You are getting the "WebDriver will only run against the DeveloperPreview build." because either you not are not running your built application with the "/appvve:9BD02EED-6C11-4FF0-8A3E-0B4733EE86A1_6A0357B5-AB99-4856-8A59-CF2C38579E78" argument or you do not have the Developer Channel build installed.

    You need to do this because the IE Developer Channel runs as an AppV application. As such, any application that makes calls into the Developer Channel version using the WebDriver API needs to run in the same AppV environment (which is why you must use the /appvve argument).

    Make sure you have the IEDeveloperChannel build install and try running your Unit test executable with the /Appvve argument

    Example:

    MyUnitTest.exe /appvve:9BD02EED-6C11-4FF0-8A3E-0B4733EE86A1_6A0357B5-AB99-4856-8A59-CF2C38579E78
    

    You can get the Developer Channel here: http://devchannel.modern.ie/