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.

Issue with indexes...

testerguy54testerguy54 Members
edited November -1 in Sahi - Open Source
I'm having an issue with indexes...

First, I'm having an issue with arrays. Is there a limit on the index of an array that Sahi can handle? If I have an array that contains more than 100 objects and iterate through it, Sahi always fails with a "$whatEverVariable is undefined" message or "Cannot read property "someProperty" of undefined". I tried pushing all objects indexed greater than 99 to a new array and iterating through them separately but I still get the same failure on the original array.

Second, I'm having an issue clicking on an icon which is indexed. It seems that once the index for these icons is >= 25 Sahi is no longer able to click on the icons. This is especially frustrating because the icon I'm trying to click on will always be indexed 25 or greater.

Comments

  • Hello testerguy54,

    The array that you use is a javascript array and the limit on the size of an array in javascript is heavily dependent on the user's machine. So, the problem could be a elsewhere. Could you show us the code snippet that is causing an error? It would be helpful for us to reproduce this.

    Sahi indexes complex web applications with thousands of elements. Could you point us to your application or a similar example available online? If it is not available, send us the html source of the element and the method you use to access it.

    Note: I would suggest that you avoid using indexes in your script. If a new element is added on the page, this index will change and your test will fail. Have a look at DOM and UI relations in Sahi available here.

    Regards,
    dkulkarni
  • I've managed to get around the issue I had with the array. But Im still having trouble clicking on the indexed element. I've tried several different ways with no success. Funny thing is Im able to pull the 'title' attribute and the id from the element by referencing it by the index. Also, _assertExists and _assert(_isVisible() pass, but for some reason the script won't click on it. There is no failure msg in the log like "the element/parameter was not found on the browser", the script continues to the next step and then fails (because a popup window should open, but doesn't). I've tried...

    _click(_div("SR_Repeater_Call_DocType InLine_Block[25]"));

    also...

    _click(_byClassName("SR_Repeater_Call_DocType InLine_Block[25]"));

    also...

    _div("SR_Repeater_Call_DocType InLine_Block[25]").click();

    also...

    var $clickId;
    _set($clickId, _div("SR_Repeater_Call_DocType InLine_Block[25]").id);
    _click(_div($clickId));

    also...

    _div($clickId).click();

    also...

    _click(_byId($clickId));



    Like I said before, if I change the index of any of the above to less than 25, Sahi will click on those elements and open the popup window. This is very frustrating as I know this element will always be indexed as 25 and this is the exact link I need to click on...

    In addition, I tried using the DOM/UI relations with the same results.
  • I've found away to click on the desired element... But now I'm having an issue with the array again... Frustrated...
Sign In or Register to comment.