使用
DP
(
Descriptive Programming
)时,可以使用两种方法,一种是直接描述的办法,另外一种是使用
Description
对象来存储描述:
Method
1 – Using String Description
Browser("Browser").Page("Google").WebButton("type:=Submit",
_
"name:=Google Search", "html tag:=INPUT").Click
Method
2 – Using Object Description
Set oGoogleSearch = Descrition.Create
oGoogleSearch("type").Value =
"Submit"
oGoogleSearch("name").Value =
"Google Search"
oGoogleSearch("html tag").Value =
"INPUT"
Browser("Browser").Page("Google").WebButton(oGoogleSearch).Click
这里做了个对比:
String Description |
Object Description |
Uses less memory as strings are |
Requires more memory as objects |
Increases statement length in |
Increase lines of code due to |
|
Preferred when property value |