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.

_setFile with javascript event handlers

keatskeats Members
edited November -1 in Sahi - Open Source
Hi Narayan,


What's the fix you gave for this?_setFile does not work me too.

I was trying to record _setFile as below,
and used the test button to check the result.

_setValue(_file("ODTPath"), "smoke.odt");

And i get following error message in test evaluation window,

[Exception] [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location: "http://lnx4.eldocomp.com:3002/_s_/spr/concat.js Line: 686"]

In my application/html page i have the following code.

<Input name="ODTPath" type="file" id="ODTPath" onkeypress="return onkeyPress(event);" size="65"/>
Tagged:

Comments

  • keatskeats Members
    This build also does not seem to work for me.

    I am still not able to set the value when the type=file.
    Sahi console does not give any error but,
    test evaluation windows gives following error.

    [Exception] [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location:
    "http://lnx4.eldocomp.com:3002/_s_/spr/concat.js Line: 686"]

    Narayan,Can you help me with this?
  • keatskeats Members
    narayan wrote:
    Keats,
    I did not notice this before, but you are doing a _setValue(_file("ODTPath"), "smoke.odt");
    It should be _setFile(_file("ODTPath"), "smoke.odt");
    (It may still fail if you have javascript validations to check if a file has been set. Ping me if that is the case)
    Regards,
    Narayan

    Yes we do have javascript which gets triggered,
    Here's the source code

    HTML Line :
    <Input name="ODTPath" type="file" id="ODTPath" onkeypress="return onkeyPress(event);" size="65"/>

    Javascript :
    :
    // On keyborad input event
    function onkeyPress(e)
    {
    var key = window.event ? e.keyCode : e.which;
    if (key == 13)
    StartClick();
    e.cancelBubble = true;
    e.returnValue = false;
    return false;
    }
  • keatskeats Members
    Let me know if there is a fix for this, anyone?
Sign In or Register to comment.