Selenium webdriver c# for IE/Chrome browser is not responding quickly when trying to run all test methods in one go by login only once -


i running [test method] using selenium web driver c#. here have launch browser once , continue

execution of rest of methods sequentially 1 one. continuing execution of methods, have placed following code in test cleanup-

[testcleanup]         public void testcleanup()         {              browserwindow browserwindow = new browserwindow();             browserwindow.closeonplaybackcleanup = false;             selenium.driver.switchto().defaultcontent();         } 

but here first methods runs start 2nd ,3rd ...n methods losing focus browser hence sometime ie becomes not responding & results in test fail.

in short not able execute methods launching browser once. have maintained order test methods. when 1 [test method] finishes execution ...2nd not started.

my browser not closed second test run second test run looks not responding . 10-15 minutes starts second test method on same existing browser.

is there solution selenium web driver c#--ie & chrome browser ..always keep focus on browser window instead of other??

if want reuse browser window need follow specific pattern consistent , succesfull.

first initialize browser window in testinitialize method. since before initialization of playback engine, initialize follows:

[classinitialize] public static void initializetest(testcontext context) {      playback.initialize();      var _bw = browserwindow.launch(new uri("http://www.bing.com"));      proc = _bw.process;     _bw.closeonplaybackcleanup = false; } 

next in every test method can reuse windows follows:

[testmethod] public void codeduitestmethodfirsttest() {     browserwindow _bw = browserwindow.fromprocess(proc);    _bw.navigatetourl(new uri("http://www.bing.com"));    //do stuff here } 

unfortunately reuse of browser window in playback on chrome or firefox not supported. documented shortcoming of selenium bridge implementation: https://blogs.msdn.microsoft.com/visualstudioalm/2012/10/30/introducing-cross-browser-testing-with-coded-ui-tests/


Comments