栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Div标签既充当按钮,也充当动态按钮,例如删除,报告垃圾邮件等

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Div标签既充当按钮,也充当动态按钮,例如删除,报告垃圾邮件等

我已经尝试了以下方法,但效果很好。您只需添加足够的等待时间

    WebDriver driver = new FirefoxDriver();    WebDriverWait wait = new WebDriverWait(driver, 60 );    driver.get("https://www.gmail.com");    driver.findElement(By.id("Email")).sendKeys("xxx");    driver.findElement(By.id("next")).click();    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("Passwd"))).sendKeys("xxx");    driver.findElement(By.id("signIn")).click();    String cbox = "//table[@]//div[@]";    String delete = "//div[@]/div[@]";    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(cbox)));    int count = 1;    List<WebElement> lst = driver.findElements(By.xpath(cbox));    System.out.println("Total number of checkboxes are t: " + lst.size());    for (int i = 0; i < lst.size(); i++) {        WebElement wwe = lst.get(i);        wwe.click();        System.out.println("Checked on checkbox number t: " + count);        count++;    }    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(delete))).click();    try {        WebElement deleteButton = driver.findElement(By.xpath(delete));        boolean flag = deleteButton.isEnabled();        if (flag) { System.out.println("nDelete button is enabled");        } else { System.out.println("nDelete button is not enabled");        }        deleteButton.click();    } catch (Throwable t) {        System.out.println("nUnable to locate delete button");        System.out.println("The exception occuring is t: " + t);    }


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/406401.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号