All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jspringbot.selenium.extension.UtilityHelper Maven / Gradle / Ivy

Go to download

This is a supporting library for jspringbot to use Browserstack and other selenium events

There is a newer version: 2.29
Show newest version
package com.jspringbot.selenium.extension;


import org.jspringbot.syntax.HighlightRobotLogger;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


/**
 * Created by robertdeocampo on 04/01/2019.
 */
public class UtilityHelper {
    public static final HighlightRobotLogger LOG = HighlightRobotLogger.getLogger(UtilityHelper.class);




    public UtilityHelper() {
    }



    public void deleteFile(String filepath){
        File file = new File(filepath);
        if(file.delete()){
            LOG.keywordAppender().appendArgument("Deleted: ", filepath);
        }
        else {
            LOG.keywordAppender().appendArgument("File not exist: ", filepath);
        }
    }

    public String getMatchString(String strValue, String regex){
        String str = strValue;
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(str);
        String matched = null;
        while (matcher.find()) {
            matched = matcher.group(1);
        }
        System.out.println(matched);
        return matched;
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy