Example usage for org.openqa.selenium.interactions Action Action

List of usage examples for org.openqa.selenium.interactions Action Action

Introduction

In this page you can find the example usage for org.openqa.selenium.interactions Action Action.

Prototype

Action

Source Link

Usage

From source file:org.richfaces.fragment.common.Actions.java

License:Open Source License

public Actions triggerEventByJS(final Event event, final WebElement element) {
    return addAction(new Action() {
        @Override/*w  ww  .  j  a v a2  s.c  o m*/
        public void perform() {
            Graphene.waitGui().until().element(element).is().present();
            Utils.triggerJQ(event.getEventName(), element);
        }
    });
}

From source file:org.richfaces.fragment.orderingList.AbstractOrderingList.java

License:Open Source License

protected void selectItem(final WebElement item) {
    new Actions(driver).keyDown(Keys.CONTROL).click(item).keyUp(Keys.CONTROL).addAction(new Action() {
        @Override// w w w  .  j  ava2 s.c  o m
        public void perform() {
            Graphene.waitGui().until().element(item).attribute("class")
                    .contains(getBody().getStyleForSelectedItem());
        }
    }).perform();
}

From source file:org.richfaces.fragment.orderingList.AbstractOrderingList.java

License:Open Source License

protected void unselectAll() {
    if (!getBody().getSelectedItems().isEmpty()) {
        new Actions(driver).click(getBody().getItemsElements().get(0)).keyDown(Keys.CONTROL)
                .click(getBody().getItemsElements().get(0)).keyUp(Keys.CONTROL).addAction(new Action() {
                    @Override//from   www  .  j  a  va  2  s . c om
                    public void perform() {
                        Graphene.waitGui().until().element(getBody().getItemsElements().get(0))
                                .attribute("class").not().contains("rf-ord-sel");
                    }
                }).perform();
        if (!getBody().getSelectedItems().isEmpty()) {
            throw new RuntimeException("The unselection was not successfull.");
        }
    }
}

From source file:org.richfaces.fragment.orderingList.AbstractSelectableListItem.java

License:Open Source License

@Override
public void select(boolean deselectOthers) {
    if (deselectOthers) {
        new Actions(driver).click(getRootElement()).addAction(new Action() {
            @Override/*from   ww  w. ja  v a 2s .co m*/
            public void perform() {
                Graphene.waitGui().until().element(getRootElement()).attribute("class")
                        .contains(getStyleClassForSelectedItem());
            }
        }).perform();
    } else {
        if (!isSelected()) {
            new Actions(driver).keyDown(Keys.CONTROL).click(getRootElement()).keyUp(Keys.CONTROL)
                    .addAction(new Action() {
                        @Override
                        public void perform() {
                            Graphene.waitGui().until().element(getRootElement()).attribute("class")
                                    .contains(getStyleClassForSelectedItem());
                        }
                    }).perform();
        }
    }
}

From source file:org.richfaces.fragment.orderingList.AbstractSelectableListItem.java

License:Open Source License

@Override
public void deselect() {
    if (isSelected()) {
        new Actions(driver).keyDown(Keys.CONTROL).click(getRootElement()).keyUp(Keys.CONTROL)
                .addAction(new Action() {
                    @Override/*  w ww  . j a  v  a 2s . com*/
                    public void perform() {
                        Graphene.waitGui().until().element(getRootElement()).attribute("class").not()
                                .contains(getStyleClassForSelectedItem());
                    }
                }).perform();
    }
}

From source file:org.richfaces.fragment.pickList.RichFacesPickList.java

License:Open Source License

private void selectItem(final WebElement item) {
    new Actions(driver).keyDown(Keys.CONTROL).click(item).keyUp(Keys.CONTROL).addAction(new Action() {
        @Override/* w w  w  .j a  v  a2 s  . c om*/
        public void perform() {
            Graphene.waitGui().until().element(item).attribute("class")
                    .contains(OrderingListInPickList.SELECTED_ITEM_CLASS);
        }
    }).perform();
}

From source file:org.richfaces.tests.metamer.ftest.a4jCommandButton.TestA4JCommandButton.java

License:Open Source License

@Test
public void testOnbegin() {
    testFireEvent(commandButtonAttributes, CommandButtonAttributes.onbegin, new Action() {
        @Override/*w  w  w.j  a va  2s  . c  om*/
        public void perform() {
            page.button.click();
        }
    });
}

From source file:org.richfaces.tests.metamer.ftest.a4jCommandButton.TestA4JCommandButton.java

License:Open Source License

@Test
public void testOnbeforedomupdate() {
    testFireEvent(commandButtonAttributes, CommandButtonAttributes.onbeforedomupdate, new Action() {
        @Override//w w w . j a va 2s  . co  m
        public void perform() {
            page.button.click();
        }
    });
}

From source file:org.richfaces.tests.metamer.ftest.a4jCommandButton.TestA4JCommandButton.java

License:Open Source License

@Test
public void testOncomplete() {
    testFireEvent(commandButtonAttributes, CommandButtonAttributes.oncomplete, new Action() {
        @Override/*from   ww  w .  j av  a  2 s .  co m*/
        public void perform() {
            page.button.click();
        }
    });
}

From source file:org.richfaces.tests.metamer.ftest.a4jCommandLink.TestA4JCommandLink.java

License:Open Source License

@Test
public void testOnbegin() {
    testFireEvent(commandLinkAttributes, CommandLinkAttributes.onbegin, new Action() {
        @Override//from ww w  .  j  a  va 2s . com
        public void perform() {
            page.submitByLink();
        }
    });
}