zoukankan      html  css  js  c++  java
  • selenium-webdriver定位多个元素

      /*<div id="divId">

           <input id="userid" type="text" value="liuhaixia" title="用户名"  name="userid" class="uid">

               <input id="password" type="password" value="123456" title="密码"  name="password">

               <a href="http://192.168.66.71:8080/dss" >超链接</a>

         </div>*/

           

           //根据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<WebElement> 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"));

                       }

             }

  • 相关阅读:
    [POJ 3253] Fence Repair
    [POJ 1422] Air Raid
    [POJ 2195] Going Home
    [POJ 1273] Drainage Ditches
    [BZOJ 1718] Redundant Paths
    [POJ 1041] John's Trip
    [NOI 2003] 逃学的小孩
    __attribute__((noreturn))的用法
    回味经典——uboot1.1.6 之 第二阶段 第三阶段
    回味经典——uboot1.1.6 之 第一阶段
  • 原文地址:https://www.cnblogs.com/liuhaixia/p/7120502.html
Copyright © 2011-2022 走看看