Example usage for org.openqa.selenium By linkText

List of usage examples for org.openqa.selenium By linkText

Introduction

In this page you can find the example usage for org.openqa.selenium By linkText.

Prototype

public static By linkText(String linkText) 

Source Link

Usage

From source file:com.atanas.kanchev.testframework.core.tests.handlers.ProbeTest.java

License:Apache License

@Test
public void probeHasTextCaseSensitiveTest() throws Exception {
    Assert.assertFalse(goTo("https://bbc.co.uk").probe(By.linkText("Homepage")).hasText(true, false, "home"));
}

From source file:com.atanas.kanchev.testframework.core.tests.handlers.ProbeTest.java

License:Apache License

@Test
public void probeHasPreciseTextCaseSensitiveTest() throws Exception {
    Assert.assertFalse(//from w  ww.j  av  a  2s .c  om
            goTo("https://bbc.co.uk").probe(By.linkText("Homepage")).hasText(true, true, "homepage"));
}

From source file:com.atanas.kanchev.testframework.core.tests.handlers.ProbeTest.java

License:Apache License

@Test
public void probeIsOfTypeTest() throws Exception {
    Assert.assertTrue(goTo("https://bbc.co.uk").probe(By.linkText("Homepage")).isOfTagType("a"));
}

From source file:com.atanas.kanchev.testframework.core.tests.handlers.ProbeTest.java

License:Apache License

@Test
public void probeIsEnabledTest() throws Exception {
    Assert.assertTrue(goTo("https://bbc.co.uk").probe(By.linkText("Homepage")).isEnabled());
}

From source file:com.atanas.kanchev.testframework.core.tests.handlers.ProbeTest.java

License:Apache License

@Test
public void probeIsSelectedTest() throws Exception {
    Assert.assertTrue(goTo("https://bbc.co.uk").probe(By.linkText("Homepage")).isSelected());
}

From source file:com.atanas.kanchev.testframework.core.tests.handlers.ProbeTest.java

License:Apache License

@Test
public void probeIsActiveTest() throws Exception {
    Assert.assertFalse(goTo("https://bbc.co.uk").probe(By.linkText("Homepage")).isActive());
}

From source file:com.atanas.kanchev.testframework.core.tests.handlers.ProbeTest.java

License:Apache License

@Test
public void probeHasColorTest() throws Exception {
    Assert.assertTrue(goTo("https://bbc.co.uk").probe(By.linkText("Homepage"))
            .hasColour(CommonPageDefinitions.CSS.CSS_BACKGROUND_COLOUR, "#000000"));
}

From source file:com.autocognite.appium.lib.base.AbstractAppiumUiDriver.java

License:Apache License

public By getFinderType(String identifier, String idValue) throws Exception {
    By findBy = null;//from   w ww.j a  va 2  s .  c  o  m
    MobileWebIdentifyBy idType = null;
    try {
        idType = MobileWebIdentifyBy.valueOf(identifier.toUpperCase());
    } catch (Throwable e) {
        throwUnsupportedIndentifierException(this.getName(), "getFinderType", identifier);
    }
    switch (identifier.toUpperCase()) {
    case "ID":
        findBy = By.id(idValue);
        break;
    case "NAME":
        findBy = By.name(idValue);
        break;
    case "CLASS":
        findBy = By.className(idValue);
        break;
    case "LINK_TEXT":
        findBy = By.linkText(idValue);
        break;
    case "PARTIAL_LINK_TEXT":
        findBy = By.partialLinkText(idValue);
        break;
    case "XPATH":
        findBy = By.xpath(idValue);
        break;
    case "CSS":
        findBy = By.cssSelector(idValue);
        break;
    case "TAG":
        findBy = By.tagName(idValue);
        break;
    }
    return findBy;
}

From source file:com.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

@SuppressWarnings("incomplete-switch")
public By getFinderType(String identifier, String idValue) throws Exception {
    By findBy = null;/*from   w  ww. j  a va2s.c  o  m*/
    WebIdentifyBy idType = null;
    try {
        idType = WebIdentifyBy.valueOf(identifier.toUpperCase());
    } catch (Throwable e) {
        throwUnsupportedIndentifierException(Configurator.getComponentName("WEBDRIVER_AUTOMATOR"),
                "getFinderType", identifier);
    }
    switch (idType) {
    case ID:
        findBy = By.id(idValue);
        break;
    case NAME:
        findBy = By.name(idValue);
        break;
    case CLASS:
        findBy = By.className(idValue);
        break;
    case LINK_TEXT:
        findBy = By.linkText(idValue);
        break;
    case PARTIAL_LINK_TEXT:
        findBy = By.partialLinkText(idValue);
        break;
    case XPATH:
        findBy = By.xpath(idValue);
        break;
    case CSS:
        findBy = By.cssSelector(idValue);
        break;
    case TAG:
        findBy = By.tagName(idValue);
        break;
    }
    return findBy;
}

From source file:com.axatrikx.webdriver.ElementHelper.java

License:Apache License

private By parseLocator(String locator) {
    String locValue;/*from   w ww . j  a va2  s  .  c om*/
    By byElement = null;
    if (locator.toLowerCase().startsWith("id=")) {
        locValue = locator.substring(3);
        byElement = By.id(locValue);
    } else if (locator.toLowerCase().startsWith("name=")) {
        locValue = locator.substring(5);
        byElement = By.name(locValue);
    } else if (locator.toLowerCase().startsWith("class=")) {
        locValue = locator.substring(6);
        byElement = By.className(locValue);
    } else if (locator.toLowerCase().startsWith("css=")) {
        locValue = locator.substring(4);
        byElement = By.cssSelector(locValue);
    } else if (locator.toLowerCase().startsWith("xpath=")) {
        locValue = locator.substring(6);
        byElement = By.xpath(locValue);
    } else if (locator.toLowerCase().startsWith("classname=")) {
        locValue = locator.substring(10);
        byElement = By.className(locValue);
    } else if (locator.toLowerCase().startsWith("tagname=")) {
        locValue = locator.substring(8);
        byElement = By.tagName(locValue);
    } else if (locator.toLowerCase().startsWith("link=")) {
        locValue = locator.substring(5);
        byElement = By.linkText(locValue);
    } else if (locator.toLowerCase().startsWith("partiallinktext=")) {
        locValue = locator.substring(16);
        byElement = By.partialLinkText(locValue);
    } else {
        // set default to id
        byElement = By.id(locator);
    }
    return byElement;
}