This is a migrated thread and some comments may be shown as answers.

Error HtmlAnchor in Iframe

1 Answer 58 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Milton
Top achievements
Rank 1
Milton asked on 14 May 2015, 04:12 AM

<html>
   <head></head>
   <body>
      <iframe id="casesFrame" width="99%" height="418" frameborder="0" src="../cases/main_init" name="casesFrame" style="">
         <html class=" ext-strict x-viewport">
            <head></head>
            <body id="ext-gen3" class=" ext-gecko ext-gecko3 x-border-layout-ct">
               <ul id="ext-gen37" class="x-tree-root-ct x-tree-arrows">
                  <li class="x-tree-node">
                     <a class="x-tree-node-anchor" tabindex="1" href="" hidefocus="on">
                        <span unselectable="on">New case</span>
                     </a>

                  </li>
               </ul>
            </body>
         </html>
      </iframe>
   </body>
</html>

 

I have the following structure in my page, but I get error while performing an event "Click" link "New Case" this is iframe.
I am using the code following in "Test Studio":

Browser casesFrame = Manager.ActiveBrowser.Frames.ById ("casesFrame");
HtmlAnchor NewCase = casesFrame.Find.ByExpression <HtmlAnchor> ("InnerText = ~ New case", "tagname = a");
Assert.IsNotNull (NewCase);
newCase.Click (); //Does not perform the event ​

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 14 May 2015, 09:35 PM
Hi Milton,

Here is the correct code to use:

Browser casesFrame = Manager.ActiveBrowser.Frames.ById("casesFrame");
HtmlSpan NewCase = casesFrame.Find.ByExpression<HtmlSpan>("TextContent=New case");
Assert.IsNotNull(NewCase);
NewCase.Click();


Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Milton
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or