selenium-webdriver定位多个元素

2021-07-04 12:07

阅读:614

标签:int   password   href   多个   nbsp   put   exce   text   webdriver   

  /*

       

          

           超链接

    

*/

       

       //根据tagName定位多个元素

         public void locateMoreElements() throws IOException{

                   System.out.println("---------根据tagName定位多个元素---------");

      WebDriver driver = new FirefoxDriver();

                   driver.get("http://192.168.2.128:8080/selenium/index.jsp");

                   List elesByTagName = driver.findElements(By.tagName("input"));

                   for(WebElement ele : elesByTagName){

                            System.out.println(ele.getAttribute("type"));

                            System.out.println(ele.getAttribute("id"));

                            System.out.println(ele.getAttribute("value"));

                            System.out.println(ele.getAttribute("title"));

                   }

         }

selenium-webdriver定位多个元素

标签:int   password   href   多个   nbsp   put   exce   text   webdriver   

原文地址:http://www.cnblogs.com/liuhaixia/p/7120502.html


评论


亲,登录后才可以留言!