Search in sources :

Example 1 with SeleniumWComponentWebElement

use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWComponentWebElement in project wcomponents by BorderTech.

the class WLabelExample_Test method testGetByLabelComplexPartial.

@Test
public void testGetByLabelComplexPartial() {
    String labelText = "one or more";
    SeleniumWComponentsWebDriver driver = getDriver();
    SeleniumWComponentWebElement expected = driver.findElement(byWComponentPath("WCheckBoxSelect[1]"));
    SeleniumWComponentWebElement actual = driver.findElement(new ByLabel(labelText, true));
    Assert.assertEquals(expected.getAttribute("id"), actual.getAttribute("id"));
}
Also used : SeleniumWComponentsWebDriver(com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver) SeleniumWComponentWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWComponentWebElement) ByLabel(com.github.bordertech.wcomponents.test.selenium.ByLabel) Test(org.junit.Test)

Example 2 with SeleniumWComponentWebElement

use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWComponentWebElement in project wcomponents by BorderTech.

the class WLabelExample_Test method testGetComponentComplex.

@Test
public void testGetComponentComplex() {
    SeleniumWComponentsWebDriver driver = getDriver();
    SeleniumWLabelWebElement label = driver.findWLabel(byWComponentPath("WLabel[7]"));
    SeleniumWComponentWebElement expected = driver.findElement(byWComponentPath("WCheckBoxSelect[1]"));
    Assert.assertEquals(expected.getAttribute("id"), label.getLabelledComponent().getAttribute("id"));
}
Also used : SeleniumWComponentsWebDriver(com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver) SeleniumWLabelWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWLabelWebElement) SeleniumWComponentWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWComponentWebElement) Test(org.junit.Test)

Example 3 with SeleniumWComponentWebElement

use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWComponentWebElement in project wcomponents by BorderTech.

the class WLabelExample_Test method testGetByLabelSimple.

// Use ByLabel to get a component by label text
@Test
public void testGetByLabelSimple() {
    SeleniumWComponentsWebDriver driver = getDriver();
    String labelText = "Normal input component";
    SeleniumWComponentWebElement expected = driver.findElement(byWComponentPath("WTextField[0]"));
    SeleniumWComponentWebElement actual = driver.findElement(new ByLabel(labelText, false));
    Assert.assertEquals(expected.getAttribute("id"), actual.getAttribute("id"));
}
Also used : SeleniumWComponentsWebDriver(com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver) SeleniumWComponentWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWComponentWebElement) ByLabel(com.github.bordertech.wcomponents.test.selenium.ByLabel) Test(org.junit.Test)

Example 4 with SeleniumWComponentWebElement

use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWComponentWebElement in project wcomponents by BorderTech.

the class WLabelExample_Test method testGetByLabelComplex.

@Test
public void testGetByLabelComplex() {
    String labelText = "Select one or more options";
    SeleniumWComponentsWebDriver driver = getDriver();
    SeleniumWComponentWebElement expected = driver.findElement(byWComponentPath("WCheckBoxSelect[1]"));
    SeleniumWComponentWebElement actual = driver.findElement(new ByLabel(labelText, false));
    Assert.assertEquals(expected.getAttribute("id"), actual.getAttribute("id"));
}
Also used : SeleniumWComponentsWebDriver(com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver) SeleniumWComponentWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWComponentWebElement) ByLabel(com.github.bordertech.wcomponents.test.selenium.ByLabel) Test(org.junit.Test)

Example 5 with SeleniumWComponentWebElement

use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWComponentWebElement in project wcomponents by BorderTech.

the class WLabelExample_Test method testGetComponentSimple.

@Test
public void testGetComponentSimple() {
    SeleniumWComponentsWebDriver driver = getDriver();
    SeleniumWLabelWebElement label = driver.findWLabel(byWComponentPath("WLabel[0]"));
    SeleniumWComponentWebElement expected = driver.findElement(byWComponentPath("WTextField[0]"));
    Assert.assertEquals(expected.getAttribute("id"), label.getLabelledComponent().getAttribute("id"));
}
Also used : SeleniumWComponentsWebDriver(com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver) SeleniumWLabelWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWLabelWebElement) SeleniumWComponentWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWComponentWebElement) Test(org.junit.Test)

Aggregations

SeleniumWComponentWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWComponentWebElement)10 SeleniumWComponentsWebDriver (com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver)9 Test (org.junit.Test)9 ByLabel (com.github.bordertech.wcomponents.test.selenium.ByLabel)6 SeleniumWLabelWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWLabelWebElement)3 SeleniumWCheckBoxWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWCheckBoxWebElement)1 SeleniumWComponentInputWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWComponentInputWebElement)1 SeleniumWDialogWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWDialogWebElement)1 SeleniumWEmailFieldWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWEmailFieldWebElement)1 SeleniumWRadioButtonWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWRadioButtonWebElement)1 SeleniumWSelectWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWSelectWebElement)1 SeleniumWTextAreaWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWTextAreaWebElement)1 SeleniumWTextFieldWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWTextFieldWebElement)1 WebElement (org.openqa.selenium.WebElement)1