Examples of FluentSelect


Examples of org.seleniumhq.selenium.fluent.FluentSelect

        final Select wdSelect = mock(Select.class);

        final WebDriverException fooE = new WebDriverException("foo");
        doThrow(fooE).when(wdSelect).deselectByValue("humphrey");

        FluentSelect select = new FluentSelect(wd, we, Context.singular(null, "dummy"), new Monitor.NULL(), false) {
            @Override
            protected Select getSelect() {
                return wdSelect;
            }

            @Override
            protected Void executeAndWrapReThrowIfNeeded(Execution execution, Internal.WebElementHolder currentElement, Context ctx, boolean expectedToBeThere) {
                try {
                    execution.execute();
                    fail("should have barfed");
                } catch (AssertionError e) {
                    throw e;
                } catch (Throwable e) {
                    assertTrue(e == fooE);
                }
                throw new RuntimeException("bar");
            }
        };

        try {
            select.deselectByValue("humphrey");
        } catch (RuntimeException e) {
            assertThat(e.getMessage(), equalTo("bar"));
        }

        verify(wdSelect).deselectByValue("humphrey");
View Full Code Here

Examples of org.seleniumhq.selenium.fluent.FluentSelect

        WebDriver wd = mock(WebDriver.class);
        WebElement we = mock(WebElement.class);
        final Select wdSelect = mock(Select.class);

        FluentSelect select = new FluentSelect(wd, we, Context.singular(null, "dummy"), new Monitor.NULL(), false) {
            @Override
            protected Select getSelect() {
                return wdSelect;
            }
        };
        select.deselectByVisibleText("humphrey");

        verify(wdSelect, times(1)).deselectByVisibleText("humphrey");
        verifyNoMoreInteractions(wd, we, wdSelect);
    }
View Full Code Here

Examples of org.seleniumhq.selenium.fluent.FluentSelect

        final Select wdSelect = mock(Select.class);

        final WebDriverException fooE = new WebDriverException("foo");
        doThrow(fooE).when(wdSelect).deselectByVisibleText("humphrey");

        FluentSelect select = new FluentSelect(wd, we, Context.singular(null, "dummy"), new Monitor.NULL(), false) {
            @Override
            protected Select getSelect() {
                return wdSelect;
            }

            @Override
            protected Void executeAndWrapReThrowIfNeeded(Execution execution, Internal.WebElementHolder currentElement, Context ctx, boolean expectedToBeThere) {
                try {
                    execution.execute();
                    fail("should have barfed");
                } catch (AssertionError e) {
                    throw e;
                } catch (Throwable e) {
                    assertTrue(e == fooE);
                }
                throw new RuntimeException("bar");
            }
        };

        try {
            select.deselectByVisibleText("humphrey");
        } catch (RuntimeException e) {
            assertThat(e.getMessage(), equalTo("bar"));
        }

        verify(wdSelect).deselectByVisibleText("humphrey");
View Full Code Here

Examples of org.seleniumhq.selenium.fluent.FluentSelect

        WebDriver wd = mock(WebDriver.class);
        WebElement we = mock(WebElement.class);
        final Select wdSelect = mock(Select.class);

        FluentSelect select = new FluentSelect(wd, we, Context.singular(null, "dummy"), new Monitor.NULL(), false) {
            @Override
            protected Select getSelect() {
                return wdSelect;
            }
        };
        select.deselectByIndex(444);

        verify(wdSelect, times(1)).deselectByIndex(444);
        verifyNoMoreInteractions(wd, we, wdSelect);
    }
View Full Code Here

Examples of org.seleniumhq.selenium.fluent.FluentSelect

        final Select wdSelect = mock(Select.class);

        final WebDriverException fooE = new WebDriverException("foo");
        doThrow(fooE).when(wdSelect).deselectByIndex(444);

        FluentSelect select = new FluentSelect(wd, we, Context.singular(null, "dummy"), new Monitor.NULL(), false) {
            @Override
            protected Select getSelect() {
                return wdSelect;
            }

            @Override
            protected Void executeAndWrapReThrowIfNeeded(Execution execution, Internal.WebElementHolder currentElement, Context ctx, boolean expectedToBeThere) {
                try {
                    execution.execute();
                    fail("should have barfed");
                } catch (AssertionError e) {
                    throw e;
                } catch (Throwable e) {
                    assertTrue(e == fooE);
                }
                throw new RuntimeException("bar");
            }
        };

        try {
            select.deselectByIndex(444);
        } catch (RuntimeException e) {
            assertThat(e.getMessage(), equalTo("bar"));
        }

        verify(wdSelect).deselectByIndex(444);
View Full Code Here

Examples of org.seleniumhq.selenium.fluent.FluentSelect

        WebDriver wd = mock(WebDriver.class);
        WebElement we = mock(WebElement.class);
        final Select wdSelect = mock(Select.class);

        FluentSelect select = new FluentSelect(wd, we, Context.singular(null, "dummy"), new Monitor.NULL(), false) {
            @Override
            protected Select getSelect() {
                return wdSelect;
            }
        };
        select.getFirstSelectedOption();

        verify(wdSelect, times(1)).getFirstSelectedOption();
        verifyNoMoreInteractions(wd, we, wdSelect);
    }
View Full Code Here

Examples of org.seleniumhq.selenium.fluent.FluentSelect

        final Select wdSelect = mock(Select.class);

        final WebDriverException fooE = new WebDriverException("foo");
        doThrow(fooE).when(wdSelect).getFirstSelectedOption();

        FluentSelect select = new FluentSelect(wd, we, Context.singular(null, "dummy"), new Monitor.NULL(), false) {
            @Override
            protected Select getSelect() {
                return wdSelect;
            }

            @Override
            protected Void executeAndWrapReThrowIfNeeded(Execution execution, Internal.WebElementHolder currentElement, Context ctx, boolean expectedToBeThere) {
                try {
                    execution.execute();
                    fail("should have barfed");
                } catch (AssertionError e) {
                    throw e;
                } catch (Throwable e) {
                    assertTrue(e == fooE);
                }
                throw new RuntimeException("bar");
            }
        };

        try {
            select.getFirstSelectedOption();
        } catch (RuntimeException e) {
            assertThat(e.getMessage(), equalTo("bar"));
        }

        verify(wdSelect).getFirstSelectedOption();
View Full Code Here

Examples of org.seleniumhq.selenium.fluent.FluentSelect

        WebDriver wd = mock(WebDriver.class);
        WebElement we = mock(WebElement.class);
        final Select wdSelect = mock(Select.class);

        FluentSelect select = new FluentSelect(wd, we, Context.singular(null, "dummy"), new Monitor.NULL(), false) {
            @Override
            protected Select getSelect() {
                return wdSelect;
            }
        };
        select.isMultiple();

        verify(wdSelect, times(1)).isMultiple();
        verifyNoMoreInteractions(wd, we, wdSelect);
    }
View Full Code Here

Examples of org.seleniumhq.selenium.fluent.FluentSelect

        final Select wdSelect = mock(Select.class);

        final WebDriverException fooE = new WebDriverException("foo");
        doThrow(fooE).when(wdSelect).isMultiple();

        FluentSelect select = new FluentSelect(wd, we, Context.singular(null, "dummy"), new Monitor.NULL(), false) {
            @Override
            protected Select getSelect() {
                return wdSelect;
            }

            @Override
            protected Void executeAndWrapReThrowIfNeeded(Execution execution, Internal.WebElementHolder currentElement, Context ctx, boolean expectedToBeThere) {
                try {
                    execution.execute();
                    fail("should have barfed");
                } catch (AssertionError e) {
                    throw e;
                } catch (Throwable e) {
                    assertTrue(e == fooE);
                }
                throw new RuntimeException("bar");
            }
        };

        try {
            select.isMultiple();
        } catch (RuntimeException e) {
            assertThat(e.getMessage(), equalTo("bar"));
        }

        verify(wdSelect).isMultiple();
View Full Code Here

Examples of org.seleniumhq.selenium.fluent.FluentSelect

        WebDriver wd = mock(WebDriver.class);
        WebElement we = mock(WebElement.class);
        final Select wdSelect = mock(Select.class);

        FluentSelect select = new FluentSelect(wd, we, Context.singular(null, "dummy"), new Monitor.NULL(), false) {
            @Override
            protected Select getSelect() {
                return wdSelect;
            }
        };
        select.getOptions();

        verify(wdSelect, times(1)).getOptions();
        verifyNoMoreInteractions(wd, we, wdSelect);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.