Get the value of selenium page <input> tag and the number of each attribute

 

Get the page number of a label, id, name, class values, to aid positioning

 

        List<WebElement> lw =driver.findElements(By.tagName("input"));
        System.out.println(lw.size());
        for (WebElement webElement : lw) {
//            获取input输入框 属性id、name、Class 和文本框的值
            System.out.println(webElement.getAttribute("id")+" | "+ webElement.getAttribute("name")+" | "
            +webElement.getAttribute("class")+" | " +webElement.getText().toString());
        }

 

Guess you like

Origin www.cnblogs.com/zddwork/p/11328619.html