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

com.applitools.eyes.selenium.SeleniumEnvironmentVersions Maven / Gradle / Ivy

There is a newer version: 5.73.0
Show newest version
package com.applitools.eyes.selenium;

import com.applitools.utils.EnvironmentVersions;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.openqa.selenium.WebDriver;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class SeleniumEnvironmentVersions extends EnvironmentVersions {

    @Override
    public String getName() {
        return "eyes-selenium-java5";
    }

    @JsonProperty("selenium-webdriver")
    public String getSelenium() {
        Class clazz = WebDriver.class;
        String className = clazz.getSimpleName() + ".class";
        String classPath = clazz.getResource(className).toString();
        if (classPath.startsWith("jar")) {
            Pattern pattern = Pattern.compile("\\d+\\.\\d+\\.\\d+");
            Matcher matcher = pattern.matcher(classPath);
            if (matcher.find()) {
                return matcher.group();
            }
        }

        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy