18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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.
Beginner question - How do I retreive an ID to use later in the test?
Sorry for the beginner question - I'm just learning and I can't figure out how to do this one particular thing. Using a test, I create a new record which, upon clicking [Save] a unique ID is displayed for the record. I need to retain this ID in a variable so that I can query the record later in the test by its ID. This ID will obviously change each time I re-run the test and create a new record.
EDIT: I figured it out!!! I found another example and I was able to infer what I needed to do. Just in case someone else has a similar question, here's how I set a value into a variable based on the div ID:
<browser>
function fetchID(){
var ImpActID = _getText(_byId("FV2026"));
return ImpActID;
}
</browser>
$ImpActID = "";
_set($ImpActID, fetchID());
EDIT: I figured it out!!! I found another example and I was able to infer what I needed to do. Just in case someone else has a similar question, here's how I set a value into a variable based on the div ID:
<browser>
function fetchID(){
var ImpActID = _getText(_byId("FV2026"));
return ImpActID;
}
</browser>
$ImpActID = "";
_set($ImpActID, fetchID());
Comments
Your solution is right.
If you are just getting the id in fetchID(), you could do the same with just
Regards,
Narayan