selenium取某个元素的特定属性值

取某个元素的特定属性值

  java.lang.String getAttribute(java.lang.String attributeLocator)

  eg. selenium.getAttribute("xpath=//img[@name='picName']@style")
   例如:
   如对于一段html代码:
   <a target="newwindow"    href="http://blog.163.com/yang_jianli/blog/url_address">注册</a>

   可以使用xpath得到href属性:
   a[text()='click here']@href
   获得弹出窗口的url:
   String url= selenium.getAttribute(”a[text()='注册']@href“);

猜你喜欢

转载自bernice-liu.iteye.com/blog/1831455
今日推荐