Selenium href blank New Window test -


so, using selenium, want test links on page , see if open new window. not javascript links, basic href "target=_blank". want make sure newly opened window loaded page. can scripting link clicked, when test page title, page i'm testing on, not new window on top. how target new window , check see if page loaded?

thanks

the following worked me form attribute target="_blank" sends post request on new window:

// open action in new empty window selenium.geteval("this.page().findelement(\"//form[@id='myform']\").target='my_window'"); selenium.geteval("selenium.browserbot.getcurrentwindow().open('', 'my_window')");  //the contents load in opened window selenium.click("//form[@id='myform']//input[@value='submit']"); thread.sleep(2000);  //focus in new window selenium.selectwindow("my_window"); selenium.windowfocus(); /* .. - i.e.: asserttrue(.........); */  //close window , main 1 selenium.close(); selenium.selectwindow(null); selenium.windowfocus(); 

the html code similar to:

<form id="myform" action="/myaction.do" target="_blank">     <input type="text" name="mytext" value="some text"/>     <input type="submit" value="save"/> </form> 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -