18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Multiple iframes embedded one into other

denysdenys Members
edited March 2012 in Sahi - Open Source
Hi,

I have some problems testing page with iframes using it in JUnit tests. (with Java Driver)

there is a page structure:
<html>
<head>
<body>
  <iframe id="A">
       <iframe id="B">
         <form>
            <table id="T1">
              <...other table stuff
            </table>
          </form>
      </iframe>
  </iframe>
</body>
</...>

The problem is that I can get the iframe "B" by browser.iframe("B") however I can't access the table elements from the iframe B neither by browser.byId no by browser.byClassName. The XPath
doesn't work as well.

What is the best way to validate the table fields inside of the inner iframe B?
The browser.iframe isn't very helpful in this case because the table is a static component which displays the results of previous action (save/create) and doesn't have any interactive elements like combos, textfields etc.

Thanks in advance


OS: Windows 7
Browser: IE8
build2011-07-19

Comments

  • denysdenys Members
    I saw that it's possible to get the iframe content by doing
    browser.iframe("B").rteHTML()
    

    But in this case I need to use something like SAX parser to get the tag and value that I am interested in. As for me it's pretty complicated in this case. Are there any other approaches?
  • narayannarayan Administrators
    Hi Denys,

    You do not need to recurse into iframes. Sahi will automatically do it.
    You can access the table just with:

    browser.table("T1")

    Regards,
    Narayan
Sign In or Register to comment.