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.

When should I modify "domainfix.js"

newbienewbie Members
edited November -1 in Sahi - Open Source
There is a file "sahi\htdocs\spr\domainfix.js"
which has a commented line :

//document.domain = d.substring(ix+1)

Anybod have any clue, when should I uncomment this line ??
I came across something about that but didnt really get it... :-(

Thank you for your help !

Comments

  • narayannarayan Administrators
    If Page A has a frame or iframe which loads Page B, and if the url domains of Page A and Page B are different, Sahi has a problem automating it. This is one of Sahi's current limitations. Eg. A page from google.com embedding a page from yahoo.com.

    But if Page A and Page B are both from the same domain but from different subdomains, then Sahi can handle it, if we uncomment that line in domainfix.js. Eg. A page from abc.example.com embedding a page from xyz.example.com.

    Basically browser security mechanisms prevent javascript in a page from one domain access a page from another domain. But if they are from the same domain but different subdomains, such access is allowed, if they set their document.domain to the base domain.
  • Oh, I see now ! Is it safe to say that the uncommented line does not
    cause any problems when there is only one domain? In that case,
    we could have it uncommented as a catch-all.

    Unfortunately for me , some of the pages that I need to automate
    embed pages from other URLs...and it seems there is no workaround
    for this (understandably)...
  • narayannarayan Administrators
    There ARE workarounds. If the embedded pages are not something you wish to automate, then you can add regular expressions of those urls to sahi/config/exclude_inject.txt. That will prevent them from interfering with automation.
    For example, some websites have googleadservices.com in an iframe, displaying ads. You can add
    .*googleadservices.*
    to sahi/config/exclude_inject.txt and these will not interfere with record or playback.

    Even otherwise, Sahi can work with such pages, but it will need some tweaking. If needed I can try and help you automate it.
Sign In or Register to comment.