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.

can i use _near,_in,_under for classname ?

chaudharypareshchaudharyparesh Members
edited November -1 in Sahi - Open Source
<div class="classtext" id="16" style=""><div style="background-position: 0px -104px;" class="menu0image" id="menu0image6"></div>User</div>

i want to find id


try this

_set($msg, _div("User",_in(_byClassName("classtext"))).attributes.value);

display error TypeError: tagName is undefined
if i used TAG NAME
like
_set($msg, _div("User",_in(_byClassName("classtext","DIV"))).attributes.value);
but it's also display error
TypeError: _sahi._div("SYSTEM", _sahi._in(_sahi._byClassName("classtext", "DIV"))) is undefined


Any Solution ?

Comments

  • narayannarayan Administrators
    Hi Paresh,

    What are you trying to do? Which id do you want to find? Why?

    Do you want to find element1 relative to element2? What are element1 and element2?

    Regards,
    Narayan
  • Dear narayan

    Actually what i am trying to do that
    My Gui have one left panel in that list of menu

    Like

    User
    System
    Objects

    Every menu have one html syntax ,
    like for User


    <div class="classtext" id="menu1" style=""><div style="background-position: 0px -104px;" class="menu0image" id="menu0image6"></div>User</div>

    similarly For System

    <div class="classtext" id="menu2" style=""><div style="background-position: 0px -104px;" class="menu0image" id="menu0image6"></div>System</div>


    Now u can see difference between two html syntax is

    IN User id=menu1
    IN System id=menu2

    i can open User Menu with _click(_div("User")) and System _click(_div("System"))

    But what i want to do that
    Open User Menu with id like _click(_div("menu1")
    similarly System _click(_div("menu2")

    That's why i want to fine id with help of div content and classname
    Becuase name of the div content passed by config file and every time classname is same
    (classtext)
  • Any one have solution of my problem .
    Waiting ......

    Thanks
  • nobody have solution
  • narayannarayan Administrators
    _click(_div("menu1")) should directly work! Try to highlight _div("menu1") from the Controller, and you will see that it already identifies it that way.

    Regards,
    Narayan
Sign In or Register to comment.