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.

Help w/ tweaking Sahi API

RussellRussell Members
edited January 2013 in Sahi - Open Source
I need some help with tweaking the Sahi API. I followed instructions for doing this from the main Sahi documentation page and I was successful, up to a point, in creating a new accessor for text elements.

Here's the entry I made in file concat.js:

this.addAD({tag: "TEXT", type: null, event:"click", name: "_text", attributes: ["sahiText", "title|alt", "value", "index", "className", "name", "id"], action: "_click", value: "sahiText"});

I also added "_text" to the file normal_functions.txt.

When I fire up the Sahi Controller on my browser page and do a CTRL-mouseOver my text element I see that Sahi now recognizes an accessor "_text(3)" (so far so good).

My problem is that _text(3) is the *only* accessor. There is no alternate accessor. The accessor I need is one in based on the value of the text element. Eg. For <text id='3'>hello</text> I would want accessor _text("hello").

I patterned my concat.js entry on the _link entry. I see that when I do a CTRL-mouseOver <a font="" size="1" href="#">About</a> I get an accessor _link("About"). This is exactly the sort of behavior I'm looking for with my text accessor ... and yet it's not happening.

I admit to not exactly knowing the significance of all the portions of a this.addAD entry. I'm essentially programming by example here. Hopefully there's a modification I can make that will give me my intended result.

Answers

  • Hi Russell,
    Please try the steps that you have mentioned above, in Sahi OS version 4.4 which is the latest released Sahi OS version.
    It should work fine for you and identify your element using the text as _text("hello").

    Regards.
Sign In or Register to comment.