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.

Is <object></object> possible?

beesmanbeesman Members
edited November -1 in Sahi - Open Source
<browser>
function maximizeIE(){
try{
if(window){
var iner = '<object id=max classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"><param name="Command" value="Maximize"></object>';
if(document.getElementById("max") == null){
document.getElementsByName('btnKiss')[0].outerHTML += iner;
_alert(_byId("max").outerHTML);
_click(_byId("max"));
//_call(_byId("max").Click());
_eval("max.click()");
_alert("max");
}
}
}catch(e){
_alert(e);
_debug(e);
_log("error", e);
_logException(e);
}
}
</browser>


[object Error] occured

Comments

  • narayannarayan Administrators
    Hi Beesman,

    Invoke maximizeIE from inside _call.
    _call(maximizeIE());
    

    The browser tag loads before the page loads. So document.getElementsByName('btnKiss') will be null, and hence document.getElementsByName('btnKiss')[0] will cause an error.

    Calling it via _call makes sure that the call happens after the page is loaded.
    (I got alerts for the object tag and "max", but the window did not maximize though.)

    Regards,
    Narayan
  • beesmanbeesman Members
    hi narayan

    I also got alerts for the object tag and "max", but the window did not maximize though.

    but in static html will maximize the window,

    aaaaa.html

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <script language="javascript">
    function maximizeIE(){
    var iner = '<object id=max classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"><param name="Command" value="Maximize"></object>';
    if(document.getElementById("max") == null){
    document.getElementsByName('btnKiss')[0].outerHTML += iner;
    }
    max.Click();
    }
    </script>
    </HEAD>
    <BODY>
    <input type=button value="Maximize" onclick=maximizeIE()>
    <input type="hidden" name="btnKiss" value="dsfasdfdsf">

    </BODY>
    </HTML>

    is not supported yet?
  • narayannarayan Administrators
    Hi Beesman,

    This is not specific to Sahi. Sahi will execute any javascript that is given to it. I am not sure why it does not work. It could be some security restriction on the browser which prevents it. (On my IE8 on Windows 7, it does not work with just the html either, so I am unable to figure out the problem.)

    Regards,
    Narayan
  • beesmanbeesman Members
    edited July 2010
    Hi narayan

    it's really security restriction of browser,
    i deployed it in server , it not works well,

    and save as a static html in local
    it works fine.

    Thank you
This discussion has been closed.