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.

How to handle domainfix.js, iframe form subdomain

RamonRamon Members
edited November -1 in Sahi - Open Source
Our configuration looks like this.
AAA.service.com invokes IFrames resides at BBB.service.com and BBB.Service.com is in the same domain as a subdomain.
Now my question is.
How I configure the domainfix.js at this conifuration?
What Should I set for the document.domain? The base damain "AAA.service.com".?
I tried to set the document.domain in domainfix.js like this :

var d = window.document.domain;
var ix = d.lastIndexOf(".");
ix = d.lastIndexOf(".", ix-1);
if (ix!=-1){
document.domain = d.AAA.service.com(ix+1);
}

But it didn't work. Maybe my code above is incorrect. I have not much experience in Javascript.

At testing with IFrames. Have I more to take care about it?

Thanks for your help.

Comments

  • narayannarayan Administrators
    Set the document.domain to the base domain, which is "service.com".

    For that, domainfix.js should look like this:
    var d = window.document.domain;
    var ix = d.lastIndexOf(".");
    ix = d.lastIndexOf(".", ix-1);
    if (ix!=-1){
        document.domain = d.substring(ix+1); // uncommented
    }
    

    Regards,
    Narayan
  • Sorry, for the last confused post.
    I changed the domainfix.js like this and retrieve "d.service.com" as document domain.

    var d = d.service.com;
    var ix = d.lastIndexOf(".");
    ix = d.lastIndexOf(".", ix-1);
    if (ix!=-1){
    document.domain = d.substring.com(ix+1);
    }

    But the Object spy over the iframes elements don't still work.

    I'm afraid the reason could be, that the iframe is included in the mainframe in this way?

    <iframe src="https:..BBB.service.com/intelliform/forms/bw/standard/osg/standard/checklis/index?Id=2& ....
    style="width: 680px; height: 450px;">
    </iframe>

    If you need I can give you the original links for the necessary html-sides.

    Many thanks for your help.
    Ramon
Sign In or Register to comment.