mercredi 16 novembre 2016

Selenium Webdriver - Java - How to click checkbox based on product

HTML snippetI would like to click checkbox based on link text. There are several checkbox in the page so using the link text I wanted to find value of the checkbox so that I can click on the checkbox

Note # All values are dynamically generated

Can you please help correct the code to include this logic. Thanks

                            driver.get(new URI(driver.getCurrentUrl()).resolve("/admin/lms/tag").toString());
                            String tag_name = sheet1.getRow(j).getCell(0).getStringCellValue();
                            driver.findElement(By.linkText(tag_name)).click();
                            WaituntilElementpresent.isExist();
                            String tag_value = sheet1.getRow(j).getCell(1).getStringCellValue();
                            driver.findElement(By.cssSelector("a[href*='"+tag_value+"']")).click();
                            WaituntilElementpresent.isExist();
                            String product = sheet1.getRow(j).getCell(2).getStringCellValue();
                            WaituntilElementpresent.isExist();
                            //String test=driver.findElement(By.linkText(product)).getTagName();
                            //System.out.println("getTagName "+test);
                            driver.findElement(By.cssSelector("input[name='products[]'][value='11']")).click();




Aucun commentaire:

Enregistrer un commentaire