Package org.openqa.selenium

Examples of org.openqa.selenium.WebElement


    }

    @Test
    public void testPickExistingElement() {
        ByVisibleTextChoicePicker picker = ChoicePickerHelper.byVisibleText().match("1");
        WebElement element = picker.pick(myFragment.getDivs());
        assertNotNull(element);
        assertEquals("1", element.getText());
    }
View Full Code Here


    }

    @Test
    public void testPickNotExistingElement() {
        ByVisibleTextChoicePicker picker = ChoicePickerHelper.byVisibleText().match("non existing");
        WebElement element = picker.pick(myFragment.getDivs());
        assertNull(element);
    }
View Full Code Here

    public void setUp() {
        MockitoAnnotations.initMocks(this);

        List<WebElement> divs = new ArrayList<WebElement>();
        for (int i = 1; i <= 6; i++) {
            WebElement elem = mock(WebElement.class);
            when(elem.getText()).thenReturn("" + i);
            switch(i) {
                case 1 : when(elem.getAttribute("class")).thenReturn("odd first"); break;
                case 2 : when(elem.getAttribute("class")).thenReturn("even second"); break;
                case 3 : when(elem.getAttribute("class")).thenReturn("odd"); break;
                case 4 : when(elem.getAttribute("class")).thenReturn("even"); break;
                case 5 : when(elem.getAttribute("class")).thenReturn("odd"); break;
                case 6 : when(elem.getAttribute("class")).thenReturn("even last"); break;
            }
            divs.add(elem);
        }
        when(myFragment.getDivs()).thenReturn(divs);
    }
View Full Code Here

    @Test
    public void testRendering() {
        browser.get(contextPath + "NestedRepeatTest.jsf");

        for (int i = 0; i < 3; i++) {
            WebElement input = browser.findElement(By.id("form:outer:" + i + ":inner:0:input"));
            input.sendKeys(Integer.toString(i));
        }

        WebElement ajax = browser.findElement(By.id("form:ajax"));
        guardAjax(ajax).click();

        for (int i = 0; i < 3; i++) {
            WebElement input = browser.findElement(By.id("form:outer:" + i + ":inner:0:input"));
            assertEquals(Integer.toString(i), input.getAttribute("value"));
        }
    }
View Full Code Here

    @Test
    public void listener_with_parameter() throws InterruptedException {
        // given
        browser.get(contextPath.toExternalForm());
        WebElement cell = browser.findElement(By.id("myForm:input"));
        cell.sendKeys("123");
        Graphene.guardAjax(cell).sendKeys(Keys.TAB);
        cell = browser.findElement(By.id("myForm:input"));
        Assert.assertEquals("4", cell.getAttribute("value"));
    }
View Full Code Here

    @Test
    @Category(Failing.class)
    public void listener_with_parameter() throws InterruptedException {
        // given
        browser.get(contextPath.toExternalForm());
        WebElement button1 = browser.findElement(By.id("myForm:jsFunction"));
        Graphene.guardAjax(button1).click();
        WebElement button2 = browser.findElement(By.id("myForm2:ajax2"));
        Graphene.guardAjax(button2).click();
    }
View Full Code Here

    @Category(Smoke.class)
    public void test_dnd() throws InterruptedException {
        // given
        browser.get(contextPath.toExternalForm() + "dnd.jsf");
       
        WebElement framework = browser.findElements(By.cssSelector(".ui-draggable")).get(0);

        Actions builder = new Actions(browser);
        final Action dragAndDrop = builder.dragAndDrop(framework, phpTarget).build();
        guardAjax(dragAndDrop).perform();
View Full Code Here

    }

    @Test
    public void input_matrix() {
        browser.get(contextPath.toExternalForm() + "a4jrepeatMatrix.jsf");
        WebElement increaseLink00 = browser.findElement(By.id("form:a4jRepeatRows:0:a4jRepeatColumns:0:increaseLink"));
        WebElement clearLink00 = browser.findElement(By.id("form:a4jRepeatRows:0:a4jRepeatColumns:0:clearLink"));

        Graphene.guardAjax(increaseLink00).click();
        WebElement output00 = browser.findElement(By.id("form:outputRows:0:outputColumns:0:output"));
        WebElement input00 = browser.findElement(By.id("form:a4jRepeatRows:0:a4jRepeatColumns:0:valueInput"));
        Assert.assertEquals("1", output00.getText());
        Assert.assertEquals("1", input00.getAttribute("value"));

        Graphene.guardAjax(clearLink00).click();
        output00 = browser.findElement(By.id("form:outputRows:0:outputColumns:0:output"));
        input00 = browser.findElement(By.id("form:a4jRepeatRows:0:a4jRepeatColumns:0:valueInput"));
        Assert.assertEquals("0", output00.getText());
        Assert.assertEquals("0", input00.getAttribute("value"));
    }
View Full Code Here

    }

    @Test
    public void input_single() {
        browser.get(contextPath.toExternalForm());
        WebElement input;
        input = browser.findElement(By.id("myForm:input"));
        Assert.assertEquals("0", input.getAttribute("value"));
        input.sendKeys("123");
        WebElement submit = browser.findElement(By.id("myForm:submit"));
        Graphene.guardAjax(submit).click();
        Assert.assertEquals("0123", input.getAttribute("value"));
        WebElement clear = browser.findElement(By.id("myForm:clear"));
        Graphene.guardAjax(clear).click();
        input = browser.findElement(By.id("myForm:input"));
        Assert.assertEquals("0", input.getAttribute("value"));
    }
View Full Code Here

        selectTreeNodeByCaption("Quid securi");
        compareScreen("trees");
    }

    private void selectTreeNodeByCaption(String string) {
        WebElement e = $(TreeElement.class).first().findElement(
                By.xpath("//div[@class='v-tree-node-caption']//span[text()='"
                        + string + "']"));
        e.click();
    }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.WebElement

Copyright © 2018 www.massapicom. 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.