use of com.seleniumtests.uipage.htmlelements.SelectList in project seleniumRobot by bhecquet.
the class TestSelectList method testGetOptionsNotPresent.
@Test(groups = { "ut" }, expectedExceptions = NoSuchElementException.class)
public void testGetOptionsNotPresent() throws IOException {
when(driver.findElement(By.id("select"))).thenThrow(new NoSuchElementException("not found"));
List<WebElement> options = new SelectList("", By.id("select")).getOptions();
}
use of com.seleniumtests.uipage.htmlelements.SelectList in project seleniumRobot by bhecquet.
the class TestSelectList method testSelectByIndex.
@Test(groups = { "ut" })
public void testSelectByIndex() throws IOException {
when(option1.isSelected()).thenReturn(false);
when(option2.isSelected()).thenReturn(true);
when(element.getAttribute("multiple")).thenReturn("true");
SelectList select = new SelectList("", By.id("select"));
select.selectByIndex(1);
verify(option1).click();
verify(option2, never()).click();
}
use of com.seleniumtests.uipage.htmlelements.SelectList in project seleniumRobot by bhecquet.
the class TestSelectList method testIsMultipleMultiple.
@Test(groups = { "ut" })
public void testIsMultipleMultiple() throws IOException {
when(option1.isSelected()).thenReturn(true);
when(option2.isSelected()).thenReturn(false);
when(element.getAttribute("multiple")).thenReturn("true");
SelectList select = new SelectList("", By.id("select"));
Assert.assertTrue(select.isMultiple());
}
use of com.seleniumtests.uipage.htmlelements.SelectList in project seleniumRobot by bhecquet.
the class TestSelectList method testDeselectByCorrespondingTextNotMultiple.
@Test(groups = { "ut" }, expectedExceptions = UnsupportedOperationException.class)
public void testDeselectByCorrespondingTextNotMultiple() throws IOException {
when(option1.isSelected()).thenReturn(false);
when(option2.isSelected()).thenReturn(true);
when(element.getAttribute("multiple")).thenReturn("false");
SelectList select = new SelectList("", By.id("select"));
select.deselectByCorrespondingText("Pt2");
}
use of com.seleniumtests.uipage.htmlelements.SelectList in project seleniumRobot by bhecquet.
the class TestSelectList method testIsMultipleNotMultiple.
@Test(groups = { "ut" })
public void testIsMultipleNotMultiple() throws IOException {
when(option1.isSelected()).thenReturn(true);
when(option2.isSelected()).thenReturn(false);
when(element.getAttribute("multiple")).thenReturn("false");
SelectList select = new SelectList("", By.id("select"));
Assert.assertFalse(select.isMultiple());
}
Aggregations