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.

way to identify only by class name?

JohnPJohnP Members
edited October 2016 in Sahi Pro
I couldn't figure out a way to identify a node simply by class name. If there is a better way, please post some feedback.
I don't care if it is a div or a span, but if there is something on the page with a specific class name, the best solution I found was to use jquery:

_getText($(".className"))

Again, if there is a better way in sahi script, please update this post
I want something to the effect of
_node("classname")

Answers

  • Today, I can't get the above code to work; the jQuery identifier causes the error:
    "$" is not defined
    so I wrote this as the alternative:

    if(_exists(_div("class"))){
    var $observedText = _getText(_div("class"));
    }else if(_exists(_span("class"))){
    var $observedText = _getText(_span("class"));
    }else{
    etc.
Sign In or Register to comment.