mercredi 30 décembre 2015

I keep on getting DisconnectedContext exception, why?

So, when debugging my code I get a DisconnectedContext exception the moment I try to step into the assignment of a variable (doesn't matter what kind of variable).

In the following example I get the exception the moment it get's to bool l2 while the assignment of bool l doesn't cause the exception.

bool l = driver.Url.Contains("something");
bool l2 = driver.FindElement(By.CssSelector("#Csssomthing")).IsElementVisible();
if (l || l2)
{
    //do something 
}

public static bool IsElementVisible(this IWebElement element)
    {
        return element.Displayed && element.Enabled;
    }

Here's the call stack of the l2 assignment:

bot.dll!bot.botExtensions.LoginToAccount(OpenQA.Selenium.IWebDriver driver, string email, string password) Line 74 C#

bot.dll!bot.TheBot.Test() Line 48 C#

[Native to Managed Transition]

[Managed to Native Transition]

Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.DefaultTestMethodInvoke(object[] args) Unknown Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.RunTestMethod() Unknown Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.ExecuteTest() Unknown Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.ExecuteInternal() Unknown Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.Execute() Unknown Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.MSTestFramework.UnitTestRunner.RunInternal(Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethod testMethod, bool isDataDriven, System.Collections.Generic.Dictionary runParameters) Unknown Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.MSTestFramework.UnitTestRunner.RunSingleTest(string name, string fullClassName, bool isAsync, System.Collections.Generic.Dictionary runParameters) Unknown [AppDomain (C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll, #2) -> AppDomain (UnitTestAdapter: Running test, #4)]
Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.MixedModeExecutor.ExecuteTests(System.Collections.Generic.IEnumerable tests, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunContext runContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.ITestExecutionRecorder testExecutionRecorder, Microsoft.VisualStudio.TestPlatform.MSTestFramework.UnitTestRunner testRunner, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.TmiTestRun tmiTestRun) Unknown Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.MixedModeExecutor.ExecuteDurontoTestsInternal(System.Collections.Generic.IEnumerable tests, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunContext runContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.ITestExecutionRecorder testExecutionRecorder, string source, Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestRunDirectories runDirectories, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.TmiTestRun tmiTestRun) Unknown Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.MixedModeExecutor.ExecuteDurontoTests(System.Collections.Generic.IEnumerable tests, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunContext runContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IFrameworkHandle frameworkHandle, string source, Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestRunDirectories runDirectories, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.TmiTestRun tmiTestRun) Unknown Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.MixedModeExecutor.ExecuteTests(System.Collections.Generic.IEnumerable tests, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunContext runContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IFrameworkHandle frameworkHandle, Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestRunDirectories runDirectories, bool isDeploymentDone, string source) Unknown Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.MixedModeExecutor.ExecuteTests(System.Collections.Generic.IEnumerable tests, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunContext runContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IFrameworkHandle frameworkHandle, Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestRunDirectories runDirectories, bool isDeploymentDone) Unknown Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.MixedModeExecutor.RunTests(System.Collections.Generic.IEnumerable tests, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunContext runContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IFrameworkHandle frameworkHandle, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.TestRunCancellationToken cancellationToken) Unknown Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll!Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.MSTestExecutor.RunTests(System.Collections.Generic.IEnumerable tests, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunContext runContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IFrameworkHandle frameworkHandle) Unknown TE.RockSteadyHost.dll!WEX.TestExecution.ExecutionPlugin.ExecuteTests(System.IntPtr context, System.Collections.Generic.IDictionary rockSteadySettings) Unknown TE.RockSteadyHost.dll!WEX.TestExecution.InteropMethods.ExecuteTests(System.IntPtr context, string[] rockSteadySettings, int rockSteadySettingsSize) Unknown [AppDomain Transition]

So any ideas to what I can do?

Aucun commentaire:

Enregistrer un commentaire