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.
Full path name of Current Executing Script
Is there any way to get hold of the full path name of the current executing script?
Cheers
Donna
Cheers
Donna
Comments
I am writing my testscripts like this and it would be nice if the script would know it's own name (and maybe even the suite) automatically, so i don't need to hard-code it.
Gerhard
For the path, here is a small hack.
In the coming versions, an API _scriptPath will be added.
Donna
ScriptRunner.getScript().getFilePath().replace(/\\/g, "\\\\") does not work. can be executed. typoeof($longpath) even says it it a string. Also $longpath.search(/\\/) says there's a backslash at position 2 (C:\..). I can _debug($longpath(0, 4)) and i see C:U (C:\Users..)
But as soon as i do something else with this string, it fails. Especially the replace.
Does anybody have an idea whats wrong with this string? Or with me?
Gerhard
UPDATE: I'm at home now and cannot test it. Can it be that ...getFilePath() returns a Java-String which must first be converted to a JavaScript-String? Like this: UPDATE2: the ""+ already does this...
I organise my tests with a subdirectory for each suite. and the following snippet gives me the suite name and the test name. Cheers,
Gerhard