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

com.automation.utils.ElementBy Maven / Gradle / Ivy

Go to download

User can use webdriver with self managed mode. Just write test cases and use slandered method provided for preforming ui operations. Debug mode for getting more detailed route cause analysis.

There is a newer version: 1.3.3.1
Show newest version
package com.automation.utils;

import org.openqa.selenium.By;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.WebElement;

import java.util.List;

public class ElementBy extends By {


    @Override
    public List findElements(SearchContext searchContext) {
        return null;
    }

    public static By AttributeWithValue(String attribute, String value) {
        return By.cssSelector("[" + attribute + "='" + value + "']");

    }

    public static By AttributeValueStartWith(String attribute, String value) {
        return By.cssSelector("[" + attribute + "^='" + value + "']");
    }

    public static By AttributeContainsValue(String attribute, String value) {
        return By.cssSelector("[" + attribute + "*='" + value + "']");

    }

    public static By Id(String id) {
        return By.cssSelector("#" + id);
    }


    public static By elementWithText(String text) {
        return elementWithText(text, 1);
    }

    public static By elementWithText(String text, int index) {
        return By.xpath(".//*[text()='" + text + "'][" + index + "]");
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy