Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, windows and java based applications. Get your 30 day free trial.

Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @ sahipro.com

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.