Example usage for org.openqa.selenium By partialLinkText

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

Introduction

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

Prototype

public static By partialLinkText(String partialLinkText) 

Source Link

Usage

From source file:org.jboss.weld.probe.ftest.ProbeFunctionalTest.java

License:Apache License

@Test
public void testBeanArchiveDetail() {
    page.getBeanArchivesTab().click();/*from www. j av  a2  s.com*/
    waitAjax(driver).until().element(By.partialLinkText(ARCHIVE_NAME)).is().visible();
    guardNoRequest(driver.findElement(By.partialLinkText(ARCHIVE_NAME))).click();
    assertTrue(listOfTargetElements.stream()
            .anyMatch(webElement -> webElement.getText().equals(BeanDiscoveryMode.ALL.name())));
    assertTrue(listOfTargetElements.stream()
            .anyMatch(webElement -> webElement.getText().contains(InvocationMonitor.class.getName())));
    assertTrue(
            listOfTargetElements.stream().anyMatch(webElement -> webElement.getText().contains(ARCHIVE_NAME)));
}

From source file:org.jboss.weld.probe.ftest.ProbeFunctionalTest.java

License:Apache License

@Test
public void testBeanDetail() {
    guardAjax(page.getBeansTab()).click();
    String className = ModelBean.class.getSimpleName();
    waitAjax(driver).until().element(By.partialLinkText(className)).is().visible();
    WebElement modelBeanLink = driver.findElement(By.partialLinkText(className));
    assertTrue("Cannot find element for " + className, modelBeanLink.isDisplayed());
    guardAjax(modelBeanLink).click();//  w  w w  .  j  a v a 2s.  com
    assertTrue(listOfTargetElements.stream()
            .anyMatch(webElement -> webElement.getText().equals(ModelBean.class.getName())));
    assertTrue(listOfTargetElements.stream()
            .anyMatch(webElement -> webElement.getText().equals("@" + RequestScoped.class.getSimpleName())));
    assertTrue(listOfTargetElements.stream()
            .anyMatch(webElement -> webElement.getText().equals(JSONTestUtil.BeanType.MANAGED.name())));
    assertTrue(listOfTargetElements.stream()
            .anyMatch(webElement -> webElement.getText().equals(Model.class.getName())));
}

From source file:org.jboss.weld.probe.ftest.ProbeFunctionalTest.java

License:Apache License

@Test
public void testObserverMethodDetail() {
    page.getObserversTab().click();//from   ww w .  j a v  a  2 s .  c o m
    waitAjax().until().element(By.xpath("//h1[text()='Observer Methods']")).is().visible();
    WebElement observerLink = driver
            .findElement(By.partialLinkText(ApplicationScopedObserver.class.getSimpleName()));
    assertTrue("Cannot find element for " + ApplicationScopedObserver.class.getSimpleName(),
            observerLink.isDisplayed());
    guardAjax(observerLink).click();
    assertTrue(listOfTargetElements.stream()
            .anyMatch(webElement -> webElement.getText().equals(ApplicationScopedObserver.class.getName())));
    assertTrue(listOfTargetElements.stream().anyMatch(
            webElement -> webElement.getText().equals("@" + ApplicationScoped.class.getSimpleName())));
    assertTrue(listOfTargetElements.stream()
            .anyMatch(webElement -> webElement.getText().equals(JSONTestUtil.BeanType.MANAGED.name())));
    assertTrue(listOfTargetElements.stream()
            .anyMatch(webElement -> webElement.getText().equals("@" + Default.class.getSimpleName())));
    assertTrue(listOfTargetElements.stream()
            .anyMatch(webElement -> webElement.getText().contains(Reception.ALWAYS.name())));
    assertTrue(listOfTargetElements.stream()
            .anyMatch(webElement -> webElement.getText().contains(Reception.IF_EXISTS.name())));
}

From source file:org.jboss.weld.probe.ftest.ProbeFunctionalTest.java

License:Apache License

@Test
public void testMonitoringSessionScopeContext() throws MalformedURLException {
    invokeServletAndReturnToProbeClient();

    page.getMonitoringTab().click();/*  w  w  w . java  2 s  .  c  o m*/
    waitAjax(driver).until().element(page.getSessionScopedContext()).is().visible();
    guardAjax(page.getSessionScopedContext()).click();
    WebElement sesionScopedBean = driver
            .findElement(By.partialLinkText(SessionScopedBean.class.getSimpleName()));
    assertTrue("Cannot find element for " + SessionScopedBean.class.getSimpleName(),
            sesionScopedBean.isDisplayed());
}

From source file:org.jspringbot.keyword.selenium.ElementFinder.java

License:Open Source License

public static WebElement findByPartialLinkText(WebDriver driver, String linkText, String tagName,
        Map<String, String> attributes) {
    return filterElements(driver.findElements(By.partialLinkText(linkText)), tagName, attributes);
}

From source file:org.kitodo.selenium.AddingST.java

License:Open Source License

@Test
public void editUserConfigurationTest() throws Exception {
    Pages.getUserConfigurationPage().changeUserSettings();

    await("Wait for visible user configuration link").atMost(20, TimeUnit.SECONDS).ignoreExceptions()
            .untilAsserted(() -> assertTrue(
                    Browser.getDriver().findElement(By.partialLinkText("User configuration")).isDisplayed()));
}

From source file:org.kitodo.selenium.ManagementST.java

License:Open Source License

@Test
public void editUserConfigurationTest() throws Exception {
    Pages.getUserEditPage().changeUserSettings();

    await("Wait for visible users header").atMost(20, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
            () -> assertTrue(Browser.getDriver().findElement(By.partialLinkText("Users")).isDisplayed()));
}

From source file:org.kuali.kra.test.infrastructure.KcSeleniumHelper.java

License:Educational Community License

/**
 * Gets all active elements in the current frame with link text that matches {@code linkText} depending on the value of {@code exact}.
 * //w ww  .j  a va2 s .c o  m
 * @param linkText the link text of the element to search for
 * @param exact whether the link text should match exactly
 * @return a list of matching elements
 */
private List<WebElement> getActiveElementsByLinkText(final String linkText, final boolean exact) {
    List<WebElement> activeElements = new ArrayList<WebElement>();

    List<WebElement> elements = new ArrayList<WebElement>();
    if (exact) {
        elements.addAll(driver.findElements(By.linkText(linkText)));
    } else {
        elements.addAll(driver.findElements(By.partialLinkText(linkText)));
    }

    for (WebElement element : elements) {
        if (element.isDisplayed()) {
            activeElements.add(element);
        }
    }

    return activeElements;
}

From source file:org.kuali.rice.krad.demo.uif.library.elements.DemoElementsActionAft.java

License:Educational Community License

protected void testActionImages() throws Exception {
    waitAndClickByLinkText("Images");
    waitForElementPresentByClassName("uif-headerText-span");
    assertTextPresent("Images");
    assertTextPresent("Action Field with images");
    findElement(By.partialLinkText("Action Link with left image")).findElement(By.className("leftActionImage"));
    findElement(By.partialLinkText("Action Link with right image"))
            .findElement(By.className("rightActionImage"));
    waitAndClickByLinkText("Action Link with left image");
    acceptAlert();/*from  w w w.  jav a  2 s .  c o m*/
    waitAndClickByLinkText("Action Link with right image");
    acceptAlert();
}

From source file:org.kuali.rice.krad.demo.uif.library.widgets.DemoWidgetsSuggestAft.java

License:Educational Community License

protected void testWidgetsSuggestRichText() throws Exception {

    final String EXAMPLE_LINK_NAME = "Rich suggest options";
    final String INPUT_FIELD_NAME = "inputField8";
    final String SEARCH_VALUE = "r";

    //go to correct example
    waitAndClickByLinkText(EXAMPLE_LINK_NAME);

    //enter values
    waitAndTypeByName(INPUT_FIELD_NAME, SEARCH_VALUE);

    //verify expect suggest results
    WebElement resultLink = driver.findElement(By.partialLinkText("Rich Option 1"));
    resultLink.click();/*from  w  w  w .  j ava2s .c om*/

    //verify text is populated
    if (!driver.findElement(By.name(INPUT_FIELD_NAME)).getAttribute("value").equals("r1")) {
        fail("input text is incorrect");
    }
}