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.

how to get the text

santoshmishra28santoshmishra28 Members
edited November 2009 in Sahi - Open Source
Hi,

I want to get text from the following HTML element:

<div class="yregertxt"><strong><strong>Invalid ID or password. </strong><br/>Please try again using your full Yahoo! ID, and type the text you see in the picture below.</strong></div>

I want to get the following text "Invalid ID or password. Please try again using your full Yahoo! ID."

After this I want to assign it to a variable.

Please help!

Comments

  • Please suggest a solution for the above query.

    thanks,
    santosh
  • narayannarayan Administrators
    Santosh, try

    var $msg;
    _set($msg, _getText(_byClassName("yregertxt", "DIV")));
    _alert($msg)
  • It works.. Thanks a lot narayan :)

    I am new so will bother u a lot :)

    santosh
  • jkbjkb Members
    Would that work for the following code? I would like to be able to select and store the value for "Version" (value below is 10.4.0.0) but I don't seem to be having any luck:

    <body id="about">
    <div class="header">
    <img src="/Company/images/login/logo.png" height="50">
    </div>
    <div class="wrapper" style="min-width:350px !important; max-width:350px !important">
    <h1>My Company</h1>
    <h2>
    <div>
    <span>Version:</span><strong>10.4.0.0</strong>
    </div>
    <div>
    <span>Timestamp:</span><strong>2/12/2013 10:45 AM</strong>
    </div>
    </h2>
    </div>
    </body>

    My code:
    _set($version,_getText(_byClassName("wrapper","strong")));

    Error:
    _sahi.setServerVar('\$version', _getText(_byClassName("wrapper","strong"))); Error: The parameter passed to _getText was not found on the browser

    I'm calling this from within a custom function, IE.
  • jkbjkb Members
    Finally figured it out: _getText(_strong(_byClassName("wrapper","div)));
  • hi, im struggling with the same issue. i've tried a lot of solutions including this, but no one works.
    everytime i get this error message:
    Error: The parameter passed to _getText was not found on the browser
    im using chrome btw
Sign In or Register to comment.