Search in sources :

Example 16 with SelectList

use of com.seleniumtests.uipage.htmlelements.SelectList in project seleniumRobot by bhecquet.

the class TestSelectList method testGetFirstSelectedOptionNoneSelected.

@Test(groups = { "ut" })
public void testGetFirstSelectedOptionNoneSelected() throws IOException {
    SelectList select = new SelectList("", By.id("select"));
    WebElement option = select.getFirstSelectedOption();
    Assert.assertNull(option);
}
Also used : SelectList(com.seleniumtests.uipage.htmlelements.SelectList) WebElement(org.openqa.selenium.WebElement) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 17 with SelectList

use of com.seleniumtests.uipage.htmlelements.SelectList in project seleniumRobot by bhecquet.

the class TestSelectList method testDeselectByText.

@Test(groups = { "ut" })
public void testDeselectByText() 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.deselectByText("opt2");
    verify(option1, never()).click();
    verify(option2).click();
}
Also used : SelectList(com.seleniumtests.uipage.htmlelements.SelectList) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 18 with SelectList

use of com.seleniumtests.uipage.htmlelements.SelectList in project seleniumRobot by bhecquet.

the class TestSelectList method testDeselectByValue.

@Test(groups = { "ut" })
public void testDeselectByValue() 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.deselectByValue("opti2");
    verify(option1, never()).click();
    verify(option2).click();
}
Also used : SelectList(com.seleniumtests.uipage.htmlelements.SelectList) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 19 with SelectList

use of com.seleniumtests.uipage.htmlelements.SelectList in project seleniumRobot by bhecquet.

the class TestSelectList method testSelectedValueNoSelection.

@Test(groups = { "ut" })
public void testSelectedValueNoSelection() throws IOException {
    SelectList select = new SelectList("", By.id("select"));
    String txt = select.getSelectedValue();
    Assert.assertEquals(txt, "");
}
Also used : SelectList(com.seleniumtests.uipage.htmlelements.SelectList) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 20 with SelectList

use of com.seleniumtests.uipage.htmlelements.SelectList in project seleniumRobot by bhecquet.

the class TestFrameElement method testSelectListOutsideFrame.

@Test(groups = { "ut" })
public void testSelectListOutsideFrame() throws Exception {
    when(element.getTagName()).thenReturn("select");
    SelectList el = new SelectList("", By.id("el"));
    el.getSelectedText();
    verify(locator, times(0)).frame(any(WebElement.class));
}
Also used : SelectList(com.seleniumtests.uipage.htmlelements.SelectList) WebElement(org.openqa.selenium.WebElement) RemoteWebElement(org.openqa.selenium.remote.RemoteWebElement) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Aggregations

SelectList (com.seleniumtests.uipage.htmlelements.SelectList)35 MockitoTest (com.seleniumtests.MockitoTest)34 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)34 Test (org.testng.annotations.Test)34 WebElement (org.openqa.selenium.WebElement)9 RemoteWebElement (org.openqa.selenium.remote.RemoteWebElement)2 ScenarioException (com.seleniumtests.customexception.ScenarioException)1 CheckBoxElement (com.seleniumtests.uipage.htmlelements.CheckBoxElement)1 Element (com.seleniumtests.uipage.htmlelements.Element)1 FrameElement (com.seleniumtests.uipage.htmlelements.FrameElement)1 GenericPictureElement (com.seleniumtests.uipage.htmlelements.GenericPictureElement)1 HtmlElement (com.seleniumtests.uipage.htmlelements.HtmlElement)1 LinkElement (com.seleniumtests.uipage.htmlelements.LinkElement)1 RadioButtonElement (com.seleniumtests.uipage.htmlelements.RadioButtonElement)1 NativeSelect (com.seleniumtests.uipage.htmlelements.select.NativeSelect)1 StubSelect (com.seleniumtests.uipage.htmlelements.select.StubSelect)1 NoSuchElementException (org.openqa.selenium.NoSuchElementException)1 WebDriverException (org.openqa.selenium.WebDriverException)1