读书人

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

发布时间: 2012-11-01 11:11:32 作者: rapoo

遍历指定浏览器页面特定元素,并返回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

?

读书人网 >其他相关

热点推荐