首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 其他相关 >

遍历指定浏览器页面特定元素,并回来locator

2012-11-01 
遍历指定浏览器页面特定元素,并返回locator####################################################Get spe

遍历指定浏览器页面特定元素,并返回locator

####################################################Get specific element by traversal the whole page#############################################  def get_element(elem_type,elem_attr,elem_text,ie_n)    begin      if ie_n==1 #ie main window element          if elem_type=~ /checkbox/i            if elem_attr=~/index/i                locator= $ie.checkboxes[elem_text].id.to_s              end          end      elsif ie_n==2 #ie sub window(or pop window)          if elem_type=~ /checkbox/i              if elem_attr=~/index/i                  locator= $ie2.checkboxes[elem_text].id.to_s              end          end        end      end      puts locator     return locator  end

?

热点排行