Sunday, June 16, 2013

Selection multiple options from Drop-down with Checkbox List

In Continuation of the Drop-down topic that i have written earlier ( Click to read) , i forget to mention one more kind of Drop-down  as given below :-


 This works as follow   , on clicking All residential Properties , a drop down will appear with multiple checkbox to select . user can select Multiple option at a time from this Checkbox list . The Concept for this is again same

Click on Main element , wait for subelement to appear on the screen and click on submenu one by one using ActionBuilder Class. Let's come to code

    Actions action = new Actions(driver);
    WebElement mainDropdownElement = driver.findElement(By.id("proptypecheck")); // main Element
    WebElement subElement1 = driver.findElement(By.id("ptypecheck_5")); // Sub Element 1
    WebElement SubElement2 = driver.findElement(By.id("ptypecheck_8")); // SubElement 2
    /* Action_one basically dealing with clicking main Element and action after that is clicking on Checkboxex one by one */   
    Action action_one = action.click(mainDropdownElement).build();
    action_one.perform();
    Thread.sleep(2000);   
     action.click(subElement1).click(SubElement2).build().perform()    ;

Hope that Helped ....






No comments:

Post a Comment