亚洲好骚综合-亚洲黄色录像-亚洲黄色网址-亚洲黄色网址大全-99久久99久久-99久久99久久精品国产

您的位置:軟件測試 > 開源軟件測試 > 開源功能測試工具 >
WatiN中所有的控件以及控件的識別方法
作者:網絡轉載 發布時間:[ 2013/12/4 13:43:34 ] 推薦標簽:

在WatiN的源代碼中可以看到所有的控件識別設計類都是在繼承了與element相關的類
包括Element, ElementAttributeBag, ElementCollection, ElementContainer, ElementSupport, ElementTag。
首先來看Element的類可以看到它繼承IAttributeBag類,在Elemental類中寫到的方法有:
1. Classname: Get the name of the stylesheet class assigned to this element;得到傳輸給此控件默認格式類的名稱。返回值為string.
2. Complete: Boolean Value, Get a value indicating whether the element is completely loaded;得到一個波爾值,查看是否此對當前控件的操作完全加載。返回值為波爾值.
3. Enabled: Get a Value indicating whether this element is enabled.得到一個波爾值來確認當前的控件是否是可用的.返回值為波爾值.
4. ID: Get the if of this element as specified in the HTML ,返回當前控件在此HTML頁面中的識別ID, 返回值為string。
5.TEXT: Get the inner text of this element(or all the inner text of all the elements contained in this elment). 返回當前控件中的文本,或者是返回當前控件所包含的控件中的所有文本,返回值為string.
6.TextBefore: Returns the text displayed before this element when it’s wrapped in a Label element, otherwise it returns null. 返回當前控件前面的Label的文本內容,如果當前控件前面的控件不是Label則返回null, 返回值為string.
7. InnerHtml: Gets the inner HTML of this element. 返回當前控件的內部HTML代碼。返回值不用說當然為string.
8. OuterText: Gets the outer text, 返回外部文檔,返回值為string.
    Shit,這個控件我還真不知道怎么用,呵呵。查了一下解釋如下:
InnerText:不包括標志,標志以內的純文本  
  OuterText:包括標志,連標記及標志內的文本  
  InnerHtml:不包括標志,標志以內的Html內容  
  OuterHtml:包括標志,連標記及標志內的Html內容
9. TagName: Gets the tag name of this element 返回當前控件的標簽。返回值為string.
10. Title: Get the title. 返回當前頁面的標題。返回值為stieng.
11. NextSibling: Gets the next sibling of this element in the Dom of the HTML page.返回當前標簽在此HTML頁面Dom控件中的下一個兄弟控件。返回值為控件即(element)
12. PreviousSibling: Gets the previous sibling of this element in the Dom of the HTML page. 返回當前標簽在此HTML頁面Dom控件中的下一個兄弟控件,返回值為控件即(element)。
13. Parent: Gets the parent element of this element, If the parent type is known you can cast it to that type. 返回當前控件的父級控件,如果父級的控件類型知道,可以定義一個和父級同類型的變量控件。返回類型為控件(element).這個比較難理解,下面是舉例:
      Div
        a id="watinlink" href="http://watin.sourceforge.net" /
                  a href="http://sourceforge.net/projects/watin" /
        Div
      上面的HTML所示第二個超鏈接沒有id,如何點擊它來實現超鏈接?這時可以使用Parent這個方法:
         首先定義一個變量Div,然后把這兩個超鏈接所在的div賦值給這個Division變量。
  Div watinDiv = ie.Link(“watinlink”).Parent;
然后去找第二個Link, 可以把第一個Link看做是Links[0],那么第二個Link是Link[1]
watinDiv.Links[1].Click();
14.Style: Style is the element’s style, 返回當前控件的格式。返回類型為Style.
  15.GetAttributeValue: This method can be used is the attribute is not available as a property of the element of a subclass of the element. Need a parameter’attributeName’, this parameter should be the name of the property exposed by IE on it’s element object. The return is the value of the attribute if available, otherwise null is returned. 當控件的屬性不存在或者或者屬性屬于此控件的一個子類時此方法可以使用。但是需要傳遞給此方法一個參數即屬性名稱(它應該是被IE暴露的一個空間實體),返回值為控件的屬性值或者為null.
   16. ToString: Returns a string that represents the current object, or null.返回代表當前實體的值,如果沒有則返回空。返回類型為string.
   17.Click: Click this element and waits till the event is completely finished(Page is loaded and ready). 點擊當前控件然后等待,知道整個事件完成即:頁面被完全加載。無返回值.
   18.ClickNoWait: Click this instance and returns immediately. Use this method when you want to continue without waiting for the click event to be finished. Mostly used when a HTML Dialog is displayed after clicking the element. 觸發事件并立刻返回信息然后去判斷需要如何執行,通常是在點擊或者跳轉頁面還沒完成時你需要其它操作。一般情況下是在當彈出對話框時使用這個方法。無返回值。
   19.Focus: Gives the input focus to this element. 聚焦在當前這個輸入控件,我不是很明白這個方法。無返回值。
   20.DoubleClick: Doubleclicks this element. 雙擊當前的控件。無返回值。
   21.KeyDown, KeyPress, KeyUp 三個方法分別為按下鍵盤不放, 按一下鍵盤,和松開按鍵盤。很繞口. 這個應該是從.Net繼承的。
   22. Blur: Fires the blur event on this element. 這個應該是和focus相反的方法。取消對這個控件的focus.

軟件測試工具 | 聯系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網站地圖
滬ICP備07036474 2003-2017 版權所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd
主站蜘蛛池模板: 日本国产亚洲 | 欧美黑人性猛交╳xx╳动态图 | 嘿嘿嘿视频免费网站在线观看 | 人人草人人干 | 日本www色视频成人免费网站 | 麻豆一区区三三四区产品麻豆 | 国产高清视频在线观看不卡v | 色噜噜噜噜噜 | 成人免费观看视频久爱网 | 免费高清毛片天天看 | 综合 欧美 国产 视频二区 | 欧美成人aaa大片 | 污黄视频 | 多人乱p欧美4p | 欧美日韩中文视频 | 91小鲜肉| 人人澡天天澡夜夜澡 | 日本精品视频一区二区 | 欧洲性xxx| 久久久国产一区二区三区 | 午夜毛片免费看 | 国产精品视频第一区二区三区 | 一区在线播放 | 久久国产成人精品国产成人亚洲 | 2020精品极品国产色在线观看 | 东北老妇xxxxhd | 男人女人真曰批的视频动态 | 日本久久影视 | 丝袜美腿在线 | 欧美亚洲另类色国产综合 | 日本簧片 | 亚洲欧美日韩中文在线制服 | 日韩一级一欧美一级国产 | 日本精品视频一区二区 | 色婷婷色 | 夜色福利院在线看 | 日本啪啪网 | 国产二区在线播放 | 欧美成人精品不卡视频在线观看 | 操操日日 | 黄色成人在线 |