so i want to make the following code more compact is there a way? maybe with a loop or something. tried a for loop but didnt realy worked out that well..
driver.findElement(By.xpath("//input [@value='1']")).click();
driver.findElement(By.xpath("//input [@value='2']")).click();
driver.findElement(By.xpath("//input [@value='3']")).click();
driver.findElement(By.xpath("//input [@value='4']")).click();
driver.findElement(By.xpath("//input [@value='5']")).click();
driver.findElement(By.xpath("//input [@value='6']")).click();
driver.findElement(By.xpath("//input [@value='7']")).click();
driver.findElement(By.xpath("//input [@value='8']")).click();
driver.findElement(By.xpath("//input [@value='9']")).click();
driver.findElement(By.xpath("//input [@value='10']")).click();
driver.findElement(By.xpath("//input [@value='11']")).click();
driver.findElement(By.xpath("//input [@value='12']")).click();
driver.findElement(By.xpath("//input [@value='13']")).click();
driver.findElement(By.xpath("//input [@value='14']")).click();
driver.findElement(By.xpath("//input [@value='15']")).click();
driver.findElement(By.xpath("//input [@value='16']")).click();
driver.findElement(By.xpath("//input [@value='17']")).click();
driver.findElement(By.xpath("//input [@value='18']")).click();
driver.findElement(By.xpath("//input [@value='19']")).click();
Thread.sleep(1000);
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[1]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[2]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[3]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[4]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[5]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[6]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[7]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[8]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[9]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[10]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[11]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[12]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[13]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[14]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[15]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[16]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[17]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[18]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[19]")).click();
driver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/form/div/div[2]/div[1]/div[2]/div[7]/div/input[20]")).click();
driver.findElement(By.xpath("//button [@type='submit']")).click();
Thread.sleep(10000);
Those are two lists with checkboxes.
Aucun commentaire:
Enregistrer un commentaire