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.

_readFile function does not work in relative path

wasimhbrwasimhbr Members
edited November -1 in Sahi - Open Source
Hi All,

There is one issue i observe with _readFile function.

_readFile function only works with Absolute Path: [Eg: _readFile("C:\\test.txt"); ]

If we use relative path something like [Eg: _readFile("test.txt");] script fails. It does not throw any error on console. script file and text.txt exist in the same folder though.

This behavior makes it difficult to work on Mac OS. It restricts the interopobility.

I went through "http://sahi.co.in/w/_readfile" help, it does not mention any example about how to use relative path.

Can any one please let me know, how to work with relative path using _readFile() function ?

Comments

  • narayannarayan Administrators
    You can use _userDataDir() to get the userdata directory.

    Eg.
    _readFile(_userDataDir() + "/scripts/myFile.txt")
  • narayannarayan Administrators
    We will standardize all paths to be relative to userdata directory rather than script's directory. (To be done)
Sign In or Register to comment.