I'm trying to execute some CodedUI test actions in Visual Studio 2012 using various browsers.

In order to execute several test methods without losing the browser window that is open, for IE I've configured:

Global.browserWindow = BrowserWindow.Launch(new Uri(URL));
Global.browserWindow.CloseOnPlaybackCleanup = false;

For other browsers (tried out with Chrome) before instantiating the above variable, I changed the CurrentBrowser settings:

BrowserWindow.CurrentBrowser = "Chrome";

I've installed the extension: Selenium components for Cross Browser Testing and also downloaded the chromediver.exe (which is required for this configuration).

I'm able to start the first TestMethod that launches the Chrome browser and performs the login into the application.

I have in the Ordertest other test methods that should be executed after that login, but the main issue is that the chrome window is closed after the first test is executed.

I've also tried to start the browser within a ClassInitialize and TestInitialize method but the behavior is the same.

Does anyone have any idea of how to keep the non-IE browser open between tests?

  • did you check on microsoft site? social.msdn.microsoft.com/Forums/en-US/…
    – mutt
    Aug 25, 2016 at 23:50
  • Yes. Seen that before and had already set "Keep execution engine running between test runs" in Tools => Options => Web Performance Test Tools => Test Execution without any success. Also the BrowserWindow.Locate doesn't help since the browser doesn't exist no more, therefore it cannot locate it. Aug 26, 2016 at 9:24
  • Well, I know how to do it outside of coded-ui, but I personally don't like coded-ui so dropped it before I got to the stage your at...sorry I can't help more there, good luck. I'd have thought someone on the MSDN site encountered a similar thing...
    – mutt
    Aug 26, 2016 at 13:32

1 Answer 1


I'm too using CodedUI for functional automation and had used the same kind of code for reusing the browser, as reopening the browser for every test case is a overhead and effort consuming. Since our application too supports multiple browsers and hence, I too faced the same issue and from the research I made at that time, I came to know that this is a known limitation of CodedUI that you can't reuse the browser for non-IE browsers. Please refer this link for the MSDN blogs and that's the hard part of CodedUI that it supports and works well with all functionalities in IE and have some limitations in non-IE browsers.

Also, for reusing the browser in IE, I will recommend to go through the mentioned post (if you haven't already gone through this) and change your code accordingly. Using this you will need to initiate/launch browser only once in a 'Project' not once in Class or Test i.e. launch browser in 'AssemblyInitialize' method and use the same browser instance throughout all test cases or classes inside the same Project. There can be multiple projects inside your solution, then you need to launch browser once every project/assembly using 'AssemblyInitialize' method.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.