Package com.thoughtworks.selenium

Examples of com.thoughtworks.selenium.Selenium

  • link=textPattern: Select the link (anchor) element which contains text matching the specified pattern.
  • css=cssSelectorSyntax: Select the element using css selectors. Please refer to CSS2 selectors, CSS3 selectors for more information. You can also check the TestCssLocators test in the selenium test suite for an example of usage, which is included in the downloaded selenium core package.

    Currently the css selector locator supports all css1, css2 and css3 selectors except namespace in css3, some pseudo classes(:nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :visited, :hover, :active, :focus, :indeterminate) and pseudo elements(::first-line, ::first-letter, ::selection, ::before, ::after).

  • Without an explicit locator prefix, Selenium uses the following default strategies:

    Element Filters

    Element filters can be used with a locator to refine a list of candidate elements. They are currently used only in the 'name' element-locator.

    Filters look much like locators, ie.

    filterType=argument

    Supported element-filters are:

    value=valuePattern

    Matches elements based on their values. This is particularly useful for refining a list of similarly-named toggle-buttons.

    index=index

    Selects a single element based on its position in the list (offset from zero).

    String-match Patterns

    Various Pattern syntaxes are available for matching string values:

    If no pattern prefix is specified, Selenium assumes that it's a "glob" pattern.

    For commands that return multiple values (such as verifySelectOptions), the string being matched is a comma-separated list of the return values, where both commas and backslashes in the values are backslash-escaped. When providing a pattern, the optional matching syntax (i.e. glob, regexp, etc.) is specified once, as usual, at the beginning of the pattern.


        //todo: uncomment when the  JSFC-3629 is fixed
        @Ignore
         @Test
        public void _testClientSideAPI() {
            Selenium selenium = getSelenium();
            testAppFunctionalPage("/components/tabbedpane/tabbedPaneChangeSelectionStyling.jsf");
            TabbedPaneInspector tabbedPane = tabbedPane("formID:clientTP");

            // check getSelectedIndex()
            selenium.click("clientGetSelected");
            assertEquals("0", selenium.getText("empty_client"));
            verifyStyles(tabbedPane, 0);

            // check setSelectedIndex()
            selenium.click("clientSetSelected");
            selenium.click("clientGetSelected");
            assertEquals("1", selenium.getText("empty_client"));
            verifyStyles(tabbedPane, 1);
        }
    View Full Code Here


            secondCalendar.assertVisible(true);
        }

         @Test
        public void testConfirmationInside() {
            Selenium selenium = getSelenium();
            testAppFunctionalPage("/components/tabbedpane/confirmationIn.jsf");
            tabSet("fn:loadingModes").setTabIndex(1, ServerLoadingMode.getInstance());

            ConfirmationInspector confirmation1 = confirmation("fn:conf1");
            confirmation1.assertElementExists();
    View Full Code Here

        //todo: uncomment when the  JSFC-3629 is fixed
        @Ignore
         @Test
        public void _testClientTabbedPaneClientClientTabbedPane() {
            Selenium selenium = getSelenium();
            testAppFunctionalPage("/components/tabbedpane/tabbedPaneIn.jsf");
            tabSet("fn:loadingModes").setTabIndex(1, ServerLoadingMode.getInstance());
            assertTrue(selenium.isElementPresent("fn:firstItem"));
            assertTrue(selenium.isVisible("fn:firstItem"));
            assertTrue(selenium.isElementPresent("fn:secondItem"));
            assertFalse(selenium.isVisible("fn:secondItem"));

            assertTrue(selenium.getText("fn:firstHeader").equals("First tab"));
            assertTrue(selenium.getText("fn:secondHeader").equals("Second tab"));
            assertTrue(selenium.getText("fn:firstItem_firstHeader").equals("First tab"));
            assertTrue(selenium.getText("fn:firstItem_secondHeader").equals("Second tab"));
            assertTrue(selenium.getText("fn:firstItem_firstContent").equals("Some text on the first tab"));
            selenium.click("fn:firstItem_secondHeader");
            assertTrue(selenium.getText("fn:firstItem_secondContent").equals("Some text on the second tab"));

            selenium.click("fn:secondHeader");
            assertTrue(selenium.isVisible("fn:secondItem"));
            assertTrue(selenium.getText("fn:secondItem_firstHeader").equals("First tab"));
            assertTrue(selenium.getText("fn:secondItem_secondHeader").equals("Second tab"));
            assertTrue(selenium.getText("fn:secondItem_firstContent").equals("Some text on the first tab"));
            selenium.click("fn:secondItem_secondHeader");
            assertTrue(selenium.getText("fn:secondItem_secondContent").equals("Some text on the second tab"));
        }
    View Full Code Here

            assertTrue(selenium.getText("fn:secondItem_secondContent").equals("Some text on the second tab"));
        }

         @Test
        public void testTabSetInside() {
            Selenium selenium = getSelenium();
            testAppFunctionalPage("/components/tabbedpane/tabSetIn.jsf");
            tabSet("fn:loadingModes").setTabIndex(1, ServerLoadingMode.getInstance());
            element("fn:firstTabSet_firstTab").assertText("Client");
            ElementInspector firstTabSetSecondTab = element("fn:firstTabSet_secondTab");

            firstTabSetSecondTab.click();
            firstTabSetSecondTab.assertText("Server");

            selenium.click("fn:secondHeader");
            element("fn:secondTabSet_firstTab").assertText("Client");
            ElementInspector secondTabSetSecondTab = element("fn:secondTabSet_secondTab");

            secondTabSetSecondTab.click();
            secondTabSetSecondTab.assertText("Server");
    View Full Code Here

        }

        /*test cell events*/
         @Test
        public void testCellAndRowEvents() {
            Selenium selenium = getSelenium();
            testAppFunctionalPage("/components/treetable/treeTableCellRowsEvents.jsf");

            String cellPath = "tbody[0]/tr[0]/td[0]";

            ElementInspector output = element("output");
    View Full Code Here

            secondCalendar.assertVisible(true);
        }

         @Test
        public void testConfirmationInside() {
            Selenium selenium = getSelenium();
            testAppFunctionalPage("/components/tabbedpane/confirmationIn.jsf");
            tabSet("fn:loadingModes").setTabIndex(2, ServerLoadingMode.getInstance());

            ConfirmationInspector confirmation1 = confirmation("fn:conf1");
            confirmation1.assertElementExists(true);
    View Full Code Here

        //todo: uncomment when the JSFC-3629 is fixed
        @Ignore
         @Test
        public void _testServerTabbedPaneInsideServerTabbedPane() {
            Selenium selenium = getSelenium();
            testAppFunctionalPage("/components/tabbedpane/tabbedPaneIn.jsf");
            tabSet("fn:loadingModes").setTabIndex(2, ServerLoadingMode.getInstance());

            assertTrue(selenium.isElementPresent("fn:firstItem"));
            assertTrue(selenium.isVisible("fn:firstItem"));
            assertFalse(selenium.isElementPresent("fn:secondItem"));

            assertTrue(selenium.getText("fn:firstHeader").equals("First tab"));
            assertTrue(selenium.getText("fn:secondHeader").equals("Second tab"));
            assertTrue(selenium.getText("fn:firstItem_firstHeader").equals("First tab"));
            assertTrue(selenium.getText("fn:firstItem_secondHeader").equals("Second tab"));
            assertTrue(selenium.getText("fn:firstItem_firstContent").equals("Some text on the first tab"));
            selenium.click("fn:firstItem_secondHeader");
            waitForPageToLoad();
            assertTrue(selenium.getText("fn:firstItem_secondContent").equals("Some text on the second tab"));

            selenium.click("fn:secondHeader");
            waitForPageToLoad();
            assertTrue(selenium.isElementPresent("fn:secondItem"));
            assertTrue(selenium.isVisible("fn:secondItem"));
            assertTrue(selenium.getText("fn:secondItem_firstHeader").equals("First tab"));
            assertTrue(selenium.getText("fn:secondItem_secondHeader").equals("Second tab"));
            assertTrue(selenium.getText("fn:secondItem_firstContent").equals("Some text on the first tab"));
            selenium.click("fn:secondItem_secondHeader");
            waitForPageToLoad();
            assertTrue(selenium.getText("fn:secondItem_secondContent").equals("Some text on the second tab"));
        }
    View Full Code Here

        //todo: uncomment when the JSFC-3629 is fixed
        @Ignore
         @Test
        public void _testTabbedPaneClientSideEvents() {
            Selenium selenium = getSelenium();
            testAppFunctionalPage("/components/tabbedpane/tabbedPane.jsf");

            //onclick
            selenium.click("test_form:onclickTabbedPaneID");
            assertTrue(selenium.isTextPresent("onclick works"));
            assertTrue(selenium.isTextPresent("click"));

            //ondblclick
            selenium.doubleClick("test_form:ondblclickTabbedPaneID");
            assertTrue(selenium.isTextPresent("ondblclick works"));
            assertTrue(selenium.isTextPresent("dblclick"));

            //onmousedown
            selenium.mouseDown("test_form:onmousedownTabbedPaneID");
            assertTrue(selenium.isTextPresent("onmousedown works"));
            assertTrue(selenium.isTextPresent("mousedown"));

            //onmouseup
            selenium.mouseUp("test_form:onmouseupTabbedPaneID");
            assertTrue(selenium.isTextPresent("onmouseup works"));
            assertTrue(selenium.isTextPresent("mouseup"));

            //todo: uncomment if JSFC-1449 fixed
    /*    //onmouseover
        selenium.mouseOver("test_form:onmouseoverTabbedPaneID");
        assertTrue(selenium.isTextPresent("onmouseover works"));
        assertTrue(selenium.isTextPresent("mouseover"));

        //onmouseout
        selenium.mouseOut("test_form:onmouseoutTabbedPaneID");
        assertTrue(selenium.isTextPresent("onmouseout works"));
        assertTrue(selenium.isTextPresent("mouseout"));*/

            //onmousemove
            selenium.mouseMove("test_form:onmousemoveTabbedPaneID");
            assertTrue(selenium.isTextPresent("onmousemove works"));
            assertTrue(selenium.isTextPresent("mousemove"));

            //onkeydown
            selenium.keyDown("test_form:firstTabKeyDownInputID", "77");
            assertTrue(selenium.isTextPresent("onkeydown works"));
            assertTrue(selenium.isTextPresent("keydown"));

            //onkeyup
            selenium.keyUp("test_form:firstTabKeyUpInputID", "77");
            assertTrue(selenium.isTextPresent("onkeyup works"));
            assertTrue(selenium.isTextPresent("keyup"));

            //onkeypress
            selenium.keyPress("test_form:firstTabKeyPressInputID", "77");
            assertTrue(selenium.isTextPresent("onkeypress works"));
            assertTrue(selenium.isTextPresent("keypress"));

            //onselectionchange
            tabbedPane("test_form:onselectionchangeTabbedPaneID").tabSet().tabs().get(1).click();
            OpenFacesAjaxLoadingMode.getInstance().waitForLoad();
            assertTrue(selenium.isTextPresent("onselectionchange works"));
            //todo: uncomment if JSFC-1447 and JSFC-1448 fixed
            /*assertTrue(selenium.isTextPresent("selectionchange"));*/
        }
    View Full Code Here

            secondCalendar.assertVisible(true);
        }

         @Test
        public void testConfirmationInside() {
            Selenium selenium = getSelenium();
            testAppFunctionalPage("/components/tabbedpane/confirmationIn.jsf");

            ConfirmationInspector confirmation1 = confirmation("fn:conf1");
            confirmation1.assertElementExists();
            ConfirmationInspector confirmation2 = confirmation("fn:conf2");
    View Full Code Here

        //todo: uncomment this method if JSFC-2452 fixed
        @Ignore
         @Test
        public void _testDataTableInsideAjaxTabbedPane() {
            Selenium selenium = getSelenium();
            testAppFunctionalPage("/components/tabbedpane/dataTableIn.jsf");

            DataTableInspector firstDataTable = dataTable("fn:firstDataTableID");
            firstDataTable.assertElementExists();
            firstDataTable.assertVisible(true);

            DataTableInspector secondDataTable = dataTable("fn:secondDataTableID");
            secondDataTable.assertElementExists(false);
            secondDataTable.assertVisible(false);

            firstDataTable.makeAndCheckSingleSelection(1, 1);
            firstDataTable.column(0).makeSorting();
            dataTablePaginator("fn:firstDataTableID:firstPaginator").makePagination(3);
            firstDataTable.column(1).filter(DropDownFieldFilterInspector.class, "fn:firstDataTableID:filter1").makeFiltering("col2_row1");
            selenium.click("fn:secondTabID");
            OpenFacesAjaxLoadingMode.getInstance().waitForLoad();
            secondDataTable.assertElementExists(false);
            secondDataTable.assertVisible(false);
            secondDataTable.makeAndCheckSingleSelection(0, 1);
            secondDataTable.column(2).makeSorting();
    View Full Code Here

    TOP

    Related Classes of com.thoughtworks.selenium.Selenium

    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.