c# - Selenium Script halts while switching window handles -


im facing same issue described here

but closed thread. im using selenium webdriver 2.48.2, on win7 ie 11. situation goes this, have test clicks on button supposed open new experiment, new experiment opens in new tab on chrome , in same tab on firefox, opens in new window on ie11 when run through selenium. strange thing not open in new window when browser opened manually instead of through selenium script. maybe selenium script opens new webdriver? , script halts while searching new page's elements. code is, checks if new handle opened or not, finds new handle , switches window handle newer one. here c# code snippet.

 private static tresult triggerandwaitfornewwindow<tresult>(pageobject pageobject, action action, int timeout = 30)   tresult : pageobject, new() {   iparent parent = pageobject.driver;   list<string> existinghandles = pageobject.driver.windowhandles.tolist();   action();    string popuphandle = wait.until(() =>   {     string foundhandle = null;     list<string> currenthandles = pageobject.driver.windowhandles.tolist();     var differenthandles = getdifference(existinghandles, currenthandles);      if (differenthandles.count > 0)     {       boolean hassomelength = differenthandles[differenthandles.count-1].length > 1;        if (hassomelength)         foundhandle = differenthandles[differenthandles.count - 1];           }     return foundhandle;   }, "waiting new window handle appear", timeout, 2000);    // init new page object override window handle   tresult page = pageobject.init<tresult>(parent);   page.windowhandle = popuphandle;    page.switchtomywindow();   return page; } 

private static list<string> getdifference(list<string> existinghandles, list<string> currenthandles) {         system.threading.thread.sleep(15000);         return currenthandles.except(existinghandles).tolist(); } 

halts inside function on ie11

public boolean switchtomywindow() {       try   {     string windowhandle = this.windowhandle; // must old handle     try     {       if (this.driver.currentwindowhandle == windowhandle)       {         log.info("no need cswitch window");         return true;       }     }     catch(exception e)     {       log.warn("we have no current driver window, must have been closed");     }      log.info("switching window handle {0}", this.driver.currentwindowhandle);     this.driver.switchto().window(windowhandle); <---- halts here on ie11     //pause.milliseconds(500);             boolean switched = wait.until(() =>               this.driver.currentwindowhandle == windowhandle, "waiting window handle active one", 5, 1000);         }   catch (openqa.selenium.webdrivertimeoutexception tex)   {    }   return true; } 

did else ever faced issue? how can resolve it?

can verify if selenium supports target os? possible selenium not supported on target os.

please check following link more details. http://grokbase.com/t/gg/webdriver/1267fdkgaa/openqa-selenium-nosuchwindowexception-with-ie9-and-windows-2008


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -