java - NoSuchElementException in iframe in frameset -


i using ie9 here html want test, window opens after 'click' add button

>doctype html public "-//w3c//dtd html 4.01 frameset//en" "http://www.w3.org/tr/html4/frameset.dtd" ><html lang="pl" dir="ltr"> >   <head> >       <title>sometitle</title> >       <somecode> >   <frameset title="sometitle2" rows="100%,*" onunload="_checkunload(event)"> >       <frame title="sometitle2" src="/somelink&loc=pl" frameborder="0" noresize="" longdesc="#"> >       <!--rce quirks mode ie--> >       <!--doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd" --> >           <html xmlns="http://www.w3.org/1999/xhtml"> >           +<head> >           <body class="somebody" onload="return _chain('_checkload()','self.settimeout(\'sizewin(self,0,0,null)\',100);',this,event)" onunload="return _chain('_checkunload(event)',' if ((window.event.clienty < 0) || (window.event.clientx < 0)){if(_pprrequestcount==0){if (document.getelementbyid(\'closewindow\'))document.getelementbyid(\'closewindow\').onclick.call();}}',this,event)"> >               <iframe name="_ppriframe" width="0" height="0" title="" id="_ppriframe" src="/somelink.gif" frameborder="0" longdesc="#" style="top: -100px; visibility: hidden; position: absolute;"> >               <somecode> >               <table width="100%" border="0" cellspacing="0" cellpadding="0" summary=""> >                   <tbody> >                       <tr> >                           <td class="xd5"/> >                           <td> >                               <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" summary=""> >                               <div style="top: 0px; position: relative;"> >                                   <table width="790" align="center" style="position: relative;" border="0" cellspacing="0" cellpadding="0" summary=""> >                                       <tbody> >                                           <tr> >                                               <td valign="top"> >                                               <table class="x4m" id="_id24" style="display: none;" border="0" cellspacing="0" cellpadding="0" summary=""> >                                               <form name="frmsearch" id="frmsearch" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" onkeypress="return _chain('searchonenter(event,\'searchbuttonhidden\')','return _submitonenter(event,\'frmsearch\');',this,event,true)" action="/somelink.faces?_.8" method="post"> >                                                   +<div style="display: none; visibility: hidden;"> >                                                   <div> >                                                       +<div style="width: 100%; position: relative;"> >                                                       <div id="searchcriteria"> >                                                           <div style="margin-top: 10px;"/> >                                                           <table class="x4m" id="_id83" style="width: 100%;" border="0" cellspacing="0" cellpadding="0" summary=""> >                                                               <tbody> >                                                                   +<tr> >                                                                   <td class="x4s"/> >                                                                   <td style="vertical-align: top;"> >                                                                       <div class="x4z" style="width: 100%; height: 100%;"> >                                                                           <table width="100%" border="0"> >                                                                               <tbody> >                                                                                   <tr> >                                                                                       <td width="50%"> >                                                                                           <table class="xdh" id="name_c_whole" border="0" cellspacing="0" cellpadding="0" summary=""> >                                                                                               <tbody> >                                                                                                   <tr> >                                                                                                       +<td width="130" class="xdj"> >                                                                                                       +<td width="20" class="xdl"> >                                                                                                       <td width="50" class="xdm"> >                                                                                                           <span class="x1b"> >                                                                                                               <input name="name_c" tabindex="14" class="x1m" id="name_c" style="background-image: none; background-attachment: scroll; background-repeat: repeat; background-position-x: 0%; background-position-y: 0%; background-color: white;" onkeyup=";" type="text" size="40" maxlength="50"/> >                                                                                                               <script>invokeonchange('name_coperator');</script> >                                                                                                               text - empty text node >                                                                                                                >                                                                                                                >                                                                                                               <some code> >       <noframes/>                                                                              

here selenium test wrote open frame

public class wezel_iframe { private webdriver driver; private string baseurl; private stringbuffer verificationerrors = new stringbuffer();  @before public void setup() throws exception { system.setproperty("webdriver.ie.driver", "c:/selenium/ie/iedriverserver.exe"); baseurl = "somelink"; desiredcapabilities capabilities = desiredcapabilities.internetexplorer(); //capabilities.setcapability(internetexplorerdriver.introduce_flakiness_by_ignoring_security_domains, true); capabilities.setcapability("ignoreprotectedmodesettings",true); capabilities.setcapability("enablepersistenthover", false); driver = new internetexplorerdriver(capabilities); driver.manage().timeouts().implicitlywait(30, timeunit.seconds); driver.manage().window().maximize() ; }  @test public  void  testnowytestselenium() throws exception { webdriverwait wait = new webdriverwait(driver, 10); driver.get(baseurl + "somelink/login.jsp"); //<somecode> string parenthandle = driver.getwindowhandle(); // current window handle driver.findelement(by.id("function_add_button_id")).click(); // opens new window thread.sleep(3000);     (string winhandle : driver.getwindowhandles()) {     driver.switchto().window(winhandle); // switch focus  newly opened window }    driver.manage().window().maximize() ;         //window maximasing works fine     driver.switchto().frame(driver.findelement(by.cssselector("frame[title='zawartość']"))); //no exception -sims work ok     driver.switchto().frame(driver.findelement(by.id("_ppriframe")));//no exception -sims work ok     driver.findelement(by.id("name_c")).sendkeys("cmk"); // nosuchelementexception  driver.close();  driver.switchto().window(parenthandle); 

the problem cant objects within frame, no matter nosuchelementexception

try putting wait, iframes takes time load after web page loaded.

put explicit wait below:

webdriverwait wait = new webdriverwait(driver,10); wait.until(expectedconditions.frametobeavailableandswitchtoit("_ppriframe")); 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -