samedi 2 mai 2020

How to make sure I am checking the checkboxes that are unchecked selenium java

My below code does not work. Already checked checkboxes are getting unchecked when I run below code.

Need your suggestions.

''' import java.util.List; import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

import io.github.bonigarcia.wdm.WebDriverManager;

public class DropboxSelect {

public static void main(String[] args) {
    WebDriverManager.chromedriver().setup();
    WebDriver driver = new ChromeDriver(); // launch chrome

    driver.manage().window().maximize(); // maximize window
    driver.manage().deleteAllCookies(); // delete all the 
 cookies

    // dynamic wait
    driver.manage().timeouts().pageLoadTimeout(40, 
 TimeUnit.SECONDS);
    driver.manage().timeouts().implicitlyWait(10, 
TimeUnit.SECONDS);

    driver.get("https://www.jquery-az.com/boots/demo.php? 

ex=63.0_2"); // enter URL

driver.findElement(By.xpath("//button[contains(@class,'multiselect')]")).click();

    List<WebElement> list = 


driver.findElements(By.xpath("//ul[contains(@class,'multiselect- 

container')]//li//a//label"));

for (int i = 0; i < list.size(); i++) {
        System.out.println(list.get(i).getText());
        if (!list.get(i).isSelected()) {

            list.get(i).click();

        }


    }

'''




Aucun commentaire:

Enregistrer un commentaire