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.

Get element accessor

nacefnacef Members
edited November -1 in Sahi - Open Source
Hi,

how do Sahi perform to grab an element's accessor with a Ctrl+hover operation?

Is there a way to get the accessor of an element only by clicking on it? (in my case I want to display the accessor of textfields).

To make simple, I want to change the Ctrl+hover operation with a simple click and normally see the accessor on the controller.

I am checking these files to get it (I would be pleased if anyone could tell me if I'm on the good road):

*controller7.htm
*controller7.js
*suggest.js

Many thanks in advance,

mng.

Comments

  • Hi mng

    just out of curiosity... what would be the improvement in changing the Ctrl+hover function in your case? Do you have no Ctrl Button? ;-)

    regards
    Wormi
  • nacefnacef Members
    edited October 2011
    Hi globalworming,

    of course I have a Ctrl button :-) but I'll try to better explain my need.

    I have in my application to record presses of "F2" keys. I press F2 over some _textBoxes, that makes a popup window appear on screen.

    Since Sahi doesn't record F2 presses, I first added manually on my script the following line each time I pressed F2:
    _keyPress(_textbox("Component_PAGE_FORM_0_tradableAsset") ,[113,0]);
    

    I then tried to enhance the way I'm doing that, so I modified in the Sahi controller and added an "F2" button which gets the $("accessor") value once I Ctrl-hover on an element, and append the above instruction in the Evaluate expression text area of the Sahi Controller.



    This is the function I added in the controller7.js and call each time I press the F2 button on the Sahi controller:
    
    function F2Function() {
        
        var x= $("accessor").value;
        setDebugValue("_keyPress("+x+" ,[113,0]);");
        append();
        evaluateExpr();
    
    }
    

    and this is the button declaration in the controller7.htm:
    
    <input type="button" value=" F2 " onclick="F2Function()">
    
    

    What I want now, is to enhance the way I'm doing it and no longer Ctrl-hover over an element to get its accessor, I want to click on the TextBox and then simply click on the F2 button on the controller, that would grab the element's accessor, evaluate the expression and append the line to the script :)

    I hope I was clear enough, if you have any suggestions, please do not hesitate.

    Many thanks in advance,

    mng.
  • nacefnacef Members
    edited October 2011
    I finally got the solution. I had to make some changes in the concat.js file.

    This topic can be closed.

    Cheers,

    mng.
This discussion has been closed.