hello!python!

selenium 等待元素

/**
     *
     * @param driver
     * @param by
     * @param seconds 等待多少秒
     * @return
     */
    public WebElement waitPageOpen(WebDriver driver,By by,long seconds){
        WebDriverWait wait = new WebDriverWait(driver,seconds);

        WebElement custumMenu= wait.until(ExpectedConditions.visibilityOfElementLocated(by));
        return custumMenu;
    }

WebElement custumMenu=waitPageOpen(driver,By.xpath( "//aside/div/ul/li[2]/div[1]"),30);
//点击客户管理
custumMenu.click();
 

 

posted @ 2023-08-24 17:53  你坚持了吗  阅读(4)  评论(0编辑  收藏  举报
hello!python!