check and uncheck all checkboxes on selectCheckboxMenu using Arquillian Graphene

Posted: March 13, 2013 in web

Page class

 @FindBy(css = "div[id$='filter-state-dropdown_panel']")
 private WebElement stateFilterList;

public void uncheckAllFilterState() {
 toggleAllFilter(stateFilterList, true);

public void checkAllFilterState() {
 toggleAllFilter(stateFilterList, false);

private void toggleAllFilter(WebElement filterElement, boolean isCheckAll) {
 boolean isLoop = true;
 while (isLoop) {
 List<WebElement> dropDownItems = getDropDownItems(filterElement);
 for (WebElement we : dropDownItems) {
 isLoop = false;
 if (we.getAttribute("class").contains("ui-selectcheckboxmenu-checked") && isCheckAll) {
 clickElement(we, GuardType.XHR);
 isLoop = true;
 private List<WebElement> getDropDownItems(WebElement filterElement) {
 return filterElement.findElements(By.tagName("li"));

Test class

public class TestPageIT extends TestParentIT {

 public void init() {
 loginPage.submitLogin(VALID_EMAIL, VALID_PASSWORD, GuardType.HTTP);

 public void quotes_UncheckedAllStates_NoRatesDisplayed() {
 Assert.assertEquals("Cars showing unchecking all filter Body",
 getContentProperty(MESSAGEKEY), quotePage.getNoCarDisplayMessage());


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s