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).getOptions();

        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.getOptions();
        } catch (RuntimeException e) {
            assertThat(e.getMessage(), equalTo("bar"));
        }

        verify(wdSelect).getOptions();
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.getAllSelectedOptions();

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

Examples of org.seleniumhq.selenium.fluent.FluentSelect

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

       
        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.getAllSelectedOptions();
        } catch (RuntimeException e) {
            assertThat(e.getMessage(), equalTo("bar"));
        }

        verify(wdSelect).getAllSelectedOptions();
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.