Restrict Files Access
It is available since Sahi Pro V6.3.1.
By default, Sahi Pro's file manipulation APIs like
_copyFileetc. have access to all the files on the file system. This can be restricted to only specific directories by configuring the property
// Use wildcard '*' to provide access to all the files. file.accessible.dir=*; // By default, Sahi Pro has access to all the files.
// Restrict Sahi Pro's access to only the files inside example directory and its sub-directories. file.accessible.dir=D:/testing/example; // Must use '\\' or '/' as file path separator.
// Restrict SahiPro's access to only the files inside Sahi Pro's default scripts directory and its sub-directories. file.accessible.dir=userdata/scripts; // The path here is relative to Sahi Pro installation directory
// Provide access to multiple directories by separating multiple directories with semi-colon. // Restrict Sahi Pro's access to only the files inside 'scripts directory and its sub-directories' and 'example directory and its sub-directories'. file.accessible.dir=userdata/scripts; D:/example;
// Restrict Sahi Pro's access to only the script directories configured in Sahi Pro. file.accessible.dir=$scripts.dir;
- Restart Sahi Pro after updating
- Ensure that Sahi Pro has access to all the files that will be accessed using file manipulation APIs during playback. If not, then Sahi Pro will show a message as
"File Access is not allowed for <file-path>"in the logs and the script will fail.
- Note that these file restrictions are only applicable on file manipulation APIs of Sahi Pro. File access can still be accomplished by following ways :