mercredi 5 avril 2017

How to handle the automation in selenium for the dropdown with check

In my project I need to test the web app with selenium automation for the dropdown with multiselect checkbox. where I have the dropdown and i have to check the checkboxes inside that dropdown using the selenium code .

Tried code of selenium to select dropdown's checkboxes using xpath.

Select dropdown1 = new Select(driver.findElement(By.id("contract_ids")));
driver.findElement(By.xpath("/html/body/div[7]/div/div[4]/div[2]/div/form/div[2]/fieldset[1]/div[1]/div[3]/div/div/div/button")).Selected;
elementToClick.click();

or by tag name

 Select dropdown1 = new Select(driver.findElement(By.id("contract_ids")));
    WebElement checkBoxElement1=driver.findElement(By.tagName("checkBox"));
    checkBoxElement1.click();

Image of dropdown with the checkbox




Aucun commentaire:

Enregistrer un commentaire