Selenium WebDriver 使用心得(一)

上一篇 / 下一篇  2014-11-11 17:32:15 / 个人分类:学习

WebElement中的getAttribute方法在Form中的使用,如果该Form指定了Action,且Form中的取某个<a>元素的href属性,则该属性会在href前附加上Action的URL。

例如下面的页面片段

...
<form. action="http://www.baidu.com">
<a id="ele" href="#1234">测试连接</a>
</form>
...

则当有如下代码:

WebElement ele=driver.fineElement(By.id("ele"));
System.out.println(ele.getAttribute("href"));

执行时,返回结果为:http://www.baidu.com#1234

TAG:

 

评分:0

我来说两句

我的栏目

日历

« 2024-03-29  
     12
3456789
10111213141516
17181920212223
24252627282930
31      

数据统计

  • 访问量: 927
  • 日志数: 2
  • 建立时间: 2013-11-21
  • 更新时间: 2014-11-11

RSS订阅

Open Toolbar