Search in sources :

Example 36 with SeleniumWComponentsWebDriver

use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver 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 37 with SeleniumWComponentsWebDriver

use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver 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 38 with SeleniumWComponentsWebDriver

use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver 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)

Example 39 with SeleniumWComponentsWebDriver

use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.

the class WLabelExample_Test method testGetByLabelReadOnly.

@Test
public void testGetByLabelReadOnly() {
    String labelText = "A hidden label for a read only field";
    SeleniumWComponentsWebDriver driver = getDriver();
    SeleniumWComponentWebElement expected = driver.findElement(byWComponentPath("WTextField[2]"));
    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 40 with SeleniumWComponentsWebDriver

use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.

the class WLabelExample_Test method testGetByLabelReadOnlyPartial.

@Test
public void testGetByLabelReadOnlyPartial() {
    String labelText = "for a read only";
    SeleniumWComponentsWebDriver driver = getDriver();
    SeleniumWComponentWebElement expected = driver.findElement(byWComponentPath("WTextField[2]"));
    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)

Aggregations

SeleniumWComponentsWebDriver (com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver)63 Test (org.junit.Test)62 ByLabel (com.github.bordertech.wcomponents.test.selenium.ByLabel)16 UIContext (com.github.bordertech.wcomponents.UIContext)9 SeleniumWComponentWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWComponentWebElement)9 WDropdown (com.github.bordertech.wcomponents.WDropdown)6 SeleniumWCheckBoxSelectWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWCheckBoxSelectWebElement)6 WebElement (org.openqa.selenium.WebElement)5 SeleniumWTableWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWTableWebElement)4 SeleniumWLabelWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWLabelWebElement)3 SeleniumWMessagesWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMessagesWebElement)3 WButton (com.github.bordertech.wcomponents.WButton)2 WComponent (com.github.bordertech.wcomponents.WComponent)2 SeleniumWMessageBoxWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMessageBoxWebElement)2 SeleniumWMultiSelectPairWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement)2 Environment (com.github.bordertech.wcomponents.Environment)1 WCheckBoxSelect (com.github.bordertech.wcomponents.WCheckBoxSelect)1 SeleniumWRadioButtonSelectWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWRadioButtonSelectWebElement)1 File (java.io.File)1 Date (java.util.Date)1