webdriver如何操作select

上一篇 / 下一篇  2012-06-08 15:41:57 / 个人分类:原创

示例:
   需要测试的网页用firefox查看如下
<form id="searchForm" enctype="application/x-www-form-urlencoded" action="/receive/asnList.xhtml" method="post" name="searchForm">
 
如果需要点击select控件,选择其中某个菜单,然后点击查询按钮,代码如下
Select asnselect=new Select(driver.findElement(By.xpath("//form[@id='searchForm' and @name='searchForm']/table/tbody/tr/td[4]/select")));
asnselect.selectByIndex(1);
driver.findElement(By.id("searchForm.:btnQuery")).click();

TAG:

 

评分:0

我来说两句

日历

« 2024-04-28  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 53443
  • 日志数: 41
  • 文件数: 3
  • 书签数: 2
  • 建立时间: 2010-03-01
  • 更新时间: 2013-10-24

RSS订阅

Open Toolbar