C# 在编码的UI测试中更改Browser窗口中CurrentBrowser变量的值时出现问题

C# 在编码的UI测试中更改Browser窗口中CurrentBrowser变量的值时出现问题,c#,coded-ui-tests,C#,Coded Ui Tests,我已经在我的Windows server 2012 R2中安装了VS 2017(entrprise),我正试图在编码的UI测试中启动IE(11)浏览器。但每次运行下面提到的代码时,我都会看到BrowserWindow.CurrentBrowser值没有从“IE”(默认值)更改为“iexplore”(我要指定的值)。 它不会引发任何异常或错误,但也不会更改BrowserWindow.CurrentBrowser的值 Uri gotourl = new Uri(uri);

我已经在我的Windows server 2012 R2中安装了VS 2017(entrprise),我正试图在编码的UI测试中启动IE(11)浏览器。但每次运行下面提到的代码时,我都会看到BrowserWindow.CurrentBrowser值没有从“IE”(默认值)更改为“iexplore”(我要指定的值)。 它不会引发任何异常或错误,但也不会更改BrowserWindow.CurrentBrowser的值

            Uri gotourl = new Uri(uri);

            BrowserWindow.CurrentBrowser = "iexplore";

            BrowserWindow currentBrowserWindow = BrowserWindow.Launch();

            currentBrowserWindow.NavigateToUrl(gotourl);

有人能帮忙吗?

原因是找不到播放程序集类的正确版本(即Microsoft.VisualStudio.TestTools.UITesting版本14.0.0.0)。我添加了正确的版本,还添加了Playback.Initialize();之前的代码,它的工作

    Playback.Initialize();

    Uri gotourl = new Uri(uri);

    BrowserWindow.CurrentBrowser = "iexplore";

    BrowserWindow currentBrowserWindow = BrowserWindow.Launch();

    currentBrowserWindow.NavigateToUrl(gotourl);