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.

use a relative path in function _readCSVFile

wgoriswgoris Members
edited November -1 in Sahi - Open Source
Hello,

I have an issue with the function _readCSVFile. Can someone help me defining the relative path to open the datafile for the test?

The script is located in the directory: /home/werner/Workspaces/IMJV/trunk/automated-qa/src/main/resources/eloket/identificatie/scripts/myscript.sah

The datafile is located in the directory: /home/werner/Workspaces/IMJV/trunk/automated-qa/src/main/resources/eloket/identificatie/datafiles/inputdate.csv

I tried this command: var $dataExploitatieZetel = _readCSVFile( "../datafiles/exploitatieZetel.csv");

But I get the error: net.sf.sahi.util.FileNotFoundRuntimeException: java.io.FileNotFoundException: ../../datafiles/exploitatieZetel.csv (No such file or directory).

The automated tests are included in our svn repository and are available for all my collegues. This means the home dir "/home/werner/..." is variable.

Thank you in advance.

Comments

  • narayannarayan Administrators
    Hi,

    There is an API called _scriptPath which returns the path of the current script.
    As an enhancement to Sahi, we will add the ability to resolve paths relative to the main script which called it.

    Regards,
    Narayan
  • Tnx Narayan.
This discussion has been closed.