public class Resource
extends java.lang.Object
Driver Type: Desktop
| Modifier and Type | Method and Description |
|---|---|
static void |
append(java.lang.String path,
java.lang.String value,
java.lang.String encoding)
Appends content to file
|
static void |
copyFail(java.lang.String resourceFrom,
java.lang.String pathTo)
Copies file or directory.
|
static void |
copyOverwrite(java.lang.String resourceFrom,
java.lang.String pathTo)
Copies file or directory.
|
static void |
copySkip(java.lang.String resourceFrom,
java.lang.String pathTo)
Copies file or directory.
|
static boolean |
createDirectoryFail(java.lang.String path)
Creates new directory.
|
static boolean |
createDirectoryOverwrite(java.lang.String path)
Creates new directory.
|
static boolean |
createDirectorySkip(java.lang.String path)
Creates new directory.
|
static boolean |
createFileFail(java.lang.String path)
Create new file.
|
static boolean |
createFileOverwrite(java.lang.String path)
Create new file.
|
static boolean |
createFileSkip(java.lang.String path)
Create new file.
|
static boolean |
delete(java.lang.String path)
Delete file or directory
|
static boolean |
exist(java.lang.String path)
Check if file or directory exists
|
static java.util.List<java.lang.String> |
listFolder(java.lang.String path)
Lists directory contents of files
|
static java.util.List<java.lang.String> |
listFolder(java.lang.String path,
Filter filter)
Lists directory contents using
spcial filter |
static void |
moveFail(java.lang.String resourceFrom,
java.lang.String pathTo)
Moves file or directory.
|
static void |
moveOverwrite(java.lang.String resourceFrom,
java.lang.String pathTo)
Moves file or directory.
|
static void |
moveSkip(java.lang.String resourceFrom,
java.lang.String pathTo)
Moves file or directory.
|
static void |
overwrite(java.lang.String path,
java.lang.String value,
java.lang.String encoding)
Overwrites file content
|
static java.lang.String |
read(java.lang.String path,
java.lang.String encoding)
Reads file content
|
public static boolean exist(java.lang.String path)
Driver Type: Desktop
path - string representation of path to file or directory.def filePath = 'D://temp//whokilledkennedy.docx'boolean exist = Resource.exist(filePath);public static boolean delete(java.lang.String path)
Driver Type: Desktop
path - string representation of path to file or directory.def filePath = 'D://temp//whitneses.docx'boolean deleted = Resource.delete(filePath);public static boolean createFileOverwrite(java.lang.String path)
Driver Type: Desktop
path - string representation of path to file or directory.def filePath = 'D://temp//whitneses.txt'boolean created = Resource.createFileOverwrite(filePath);public static boolean createFileSkip(java.lang.String path)
Driver Type: Desktop
path - string representation of path to file or directory.def filePath = 'D://temp//takeovertheworld.pptx'boolean created = Resource.createFileSkip(filePath);public static boolean createFileFail(java.lang.String path)
Driver Type: Desktop
path - string representation of path to file or directory.org.openqa.selenium.WebDriverException - if file already exist
def filePath = 'D://temp//takeovertheworld.pptx'boolean created = Resource.createFileFail(filePath);public static java.util.List<java.lang.String> listFolder(java.lang.String path)
Driver Type: Desktop
path - string representation of path to file or directorydef filePath = 'D://temp'List folderContent = Resource.listFolder(filePath);public static java.util.List<java.lang.String> listFolder(java.lang.String path,
Filter filter)
spcial filter
Driver Type: Desktop
path - string representation of path to file or directoryfilter - Filterdef filePath = 'D://temp'List folderContent = Resource.listFolder(filePath, Filter.files().pattern('tempFile.*tmp').get());Filterpublic static boolean createDirectoryOverwrite(java.lang.String path)
Driver Type: Desktop
path - string representation of path to file or directorydef filePath = 'D://temp//newDirectory'boolean created = Resource.createDirectoryOverwrite(filePath);public static boolean createDirectorySkip(java.lang.String path)
Driver Type: Desktop
path - string representation of path to file or directorydef filePath = 'D://temp//newDirectory'boolean created = Resource.createDirectorySkip(filePath);public static boolean createDirectoryFail(java.lang.String path)
Driver Type: Desktop
path - string representation of path to file or directoryorg.openqa.selenium.WebDriverException - if directory exist
def filePath = 'D://temp//newDirectory'boolean created = Resource.createDirectoryFail(filePath);public static java.lang.String read(java.lang.String path,
java.lang.String encoding)
Driver Type: Desktop
path - string representation of path to file or directoryencoding - string representation of file encodingdef filePath = 'D://temp//newDirectory//file.txt'def content = Resource.read(filePath, 'utf-8');public static void overwrite(java.lang.String path,
java.lang.String value,
java.lang.String encoding)
Driver Type: Desktop
path - string representation of path to file or directoryvalue - string representation of text to overwrite withencoding - string representation of file encoding
def filePath = 'D://temp//newDirectory//file.txt'Resource.overwrite(filePath, 'utf-8');public static void append(java.lang.String path,
java.lang.String value,
java.lang.String encoding)
Driver Type: Desktop
path - string representation of path to file or directoryvalue - string representation of text to appendencoding - string representation of file encoding
def filePath = 'D://temp//newDirectory//file.txt'Resource.append(filePath, 'added Text', 'utf-8');public static void copyOverwrite(java.lang.String resourceFrom,
java.lang.String pathTo)
Driver Type: Desktop
resourceFrom - string representation of path to file or directory which should be copiedpathTo - string representation of a copy destination path
def resourceFrom = 'D://temp//file.txt'def pathTo = 'D://temp//newDirectory//file.txt'Resource.copyOverwrite(filePath, 'added Text', 'utf-8');public static void copySkip(java.lang.String resourceFrom,
java.lang.String pathTo)
Driver Type: Desktop
resourceFrom - string representation of path to file or directory which should be copiedpathTo - string representation of a copy destination path
def resourceFrom = 'D://temp//file.txt'def pathTo = 'D://temp//newDirectory//file.txt'Resource.copySkip(resourceFrom, pathTo);public static void copyFail(java.lang.String resourceFrom,
java.lang.String pathTo)
Driver Type: Desktop
resourceFrom - string representation of path to file or directory which should be copiedpathTo - string representation of a copy destination pathorg.openqa.selenium.WebDriverException - def resourceFrom = 'D://temp//file.txt'def pathTo = 'D://temp//newDirectory//file.txt'Resource.copyFail(resourceFrom, pathTo);public static void moveOverwrite(java.lang.String resourceFrom,
java.lang.String pathTo)
Driver Type: Desktop
resourceFrom - string representation of path to file or directory which should be copiedpathTo - string representation of a copy destination path
def resourceFrom = 'D://temp//file.txt'def pathTo = 'D://temp//newDirectory//file.txt'Resource.moveOverwrite(resourceFrom, pathTo);public static void moveSkip(java.lang.String resourceFrom,
java.lang.String pathTo)
Driver Type: Desktop
resourceFrom - string representation of path to file or directory which should be copiedpathTo - string representation of a copy destination path
def resourceFrom = 'D://temp//file.txt'def pathTo = 'D://temp//newDirectory//file.txt'Resource.moveSkip(resourceFrom, pathTo);public static void moveFail(java.lang.String resourceFrom,
java.lang.String pathTo)
Driver Type: Desktop
resourceFrom - string representation of path to file or directory which should be copiedpathTo - string representation of a copy destination pathorg.openqa.selenium.WebDriverException - def resourceFrom = 'D://temp//file.txt'def pathTo = 'D://temp//newDirectory//file.txt'Resource.moveSkip(resourceFrom, pathTo);Copyright © 2024 WorkFusion, Inc. All rights reserved.