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:io.selendroid.nativetests.NativeElementFindingTest.java

License:Apache License

@Test()
public void shouldNotFindElementsByPartialText() {
    openStartActivity();
    assertListIsEmpty(driver().findElements(By.partialLinkText("nonExistentButton")));
}

From source file:io.selendroid.nativetests.NativeElementInteractionTest.java

License:Apache License

@Test
public void shouldLongPressOnElement() {
    openStartActivity();/*from w  w w  .  j  a  v a 2 s . c  o m*/
    WebElement button = driver().findElement(By.id("buttonTest"));
    TouchActions longPress = new TouchActions(driver()).longPress(button);
    longPress.perform();
    WebElement text = driver().findElement(By.partialLinkText("Long Press Tap"));
    Assert.assertNotNull(text);
    // TODO ddary this is essential, not perfect. must be refactored
    driver().findElement(By.id("button1")).click();
}

From source file:io.selendroid.nativetests.NativeElementInteractionTest.java

License:Apache License

@Test
public void shouldTapOnElement() {
    openStartActivity();//w w  w .  j  a va  2 s. c o  m
    WebElement button = driver().findElement(By.id("buttonTest"));
    TouchActions longPress = new TouchActions(driver()).singleTap(button);
    longPress.perform();
    WebElement text = driver().findElement(By.partialLinkText("end the activity"));
    Assert.assertNotNull(text);
    // TODO ddary this is essential, not perfect. must be refactored
    driver().findElement(By.id("button2")).click();
}

From source file:io.selendroid.webviewdrivertests.WebChildElementFindingTest.java

License:Apache License

@Test
public void shouldNotFindElementByPartialText() {
    openWebdriverTestPage(HtmlTestData.FORM_PAGE);
    WebElement rootElement = driver().findElement(By.id("multi"));
    try {/*from w  w w. ja v  a  2 s  .  c om*/
        rootElement.findElement(By.partialLinkText("notThere"));
        Assert.fail("Should not have succeeded");
    } catch (NoSuchElementException e) {
        // this is expected
    }
}

From source file:io.selendroid.webviewdrivertests.WebChildElementFindingTest.java

License:Apache License

@Test
public void shouldNotFindElementsByPartialText() {
    openWebdriverTestPage(HtmlTestData.FORM_PAGE);
    WebElement rootElement = driver().findElement(By.id("multi"));
    assertListIsEmpty(rootElement.findElements(By.partialLinkText("notThere")));
}

From source file:io.selendroid.webviewdrivertests.WebChildElementFindingTest.java

License:Apache License

@Test
public void shouldFindElementByPartialText() throws Exception {
    openWebdriverTestPage(HtmlTestData.XHTML_TEST_PAGE);
    WebElement rootElement = driver().findElement(By.className("content"));
    WebElement clickMe = rootElement.findElement(By.partialLinkText("click m"));
    clickMe.click();/*w w  w.j a va 2s  .com*/

    TestWaiter.waitFor(WaitingConditions.pageTitleToBe(driver(), "We Arrive Here"), 15, TimeUnit.SECONDS);
    Assert.assertEquals(driver().getTitle(), "We Arrive Here");
}

From source file:io.selendroid.webviewdrivertests.WebChildElementFindingTest.java

License:Apache License

@Test
public void shouldFindElementsByPartialTextAndClick() throws Exception {
    openWebdriverTestPage(HtmlTestData.XHTML_TEST_PAGE);
    WebElement rootElement = driver().findElement(By.className("content"));
    WebElement clickMe = rootElement.findElements(By.partialLinkText("click m")).get(0);
    clickMe.click();/*from  w  w w . jav a  2 s  . c o  m*/

    TestWaiter.waitFor(WaitingConditions.pageTitleToBe(driver(), "We Arrive Here"), 15, TimeUnit.SECONDS);
    Assert.assertEquals(driver().getTitle(), "We Arrive Here");
}

From source file:io.selendroid.webviewdrivertests.WebElementFindingTest.java

License:Apache License

@Test
public void shouldNotFindElementByPartialText() {
    openWebdriverTestPage(HtmlTestData.FORM_PAGE);

    try {//from   w w  w .  ja v a 2 s .c  o m
        driver().findElement(By.partialLinkText("notThere"));
        Assert.fail("Should not have succeeded");
    } catch (NoSuchElementException e) {
        // this is expected
    }
}

From source file:io.selendroid.webviewdrivertests.WebElementFindingTest.java

License:Apache License

@Test
public void shouldNotFindElementsByPartialText() {
    openWebdriverTestPage(HtmlTestData.FORM_PAGE);

    assertListIsEmpty(driver().findElements(By.partialLinkText("notThere")));
}

From source file:io.selendroid.webviewdrivertests.WebElementFindingTest.java

License:Apache License

@Test
public void shouldFindElementByPartialText() throws Exception {
    openWebdriverTestPage(HtmlTestData.XHTML_TEST_PAGE);
    TestWaiter.waitForElement(By.partialLinkText("click"), 10, driver()).click();

    waitFor(pageTitleToBe(driver(), "We Arrive Here"), 15, TimeUnit.SECONDS);
    Assert.assertEquals(driver().getTitle(), "We Arrive Here");
}