Use of Object Property:
If you are working with IE, then use the Object property for accessing the internal properties and methods of Web objects. When you use the Object property on a Web object in your test or component, you actually get a reference to the DOM (Document Object Model) object. This means that every operation you can perform on the DOM object, you can also perform on the eb object using the Object property.
Some of the practical scenarios:
- Following statement can be used to get retrieve the tabindex of any object (mostly input object)in a web application.
intIndex =Browser("").Page("").Frame("").AnyWebObject("").Object.tabIndex
Note: The tab index value is very useful when you need to test the Tab Ordering among the controls. It is simple and easy instead of using micTab or sendkeys approach to test the same. - Following statement can be used to trigger the function ‘focus’ of a specific text box,
Browser("").Page("").Frame("").WebEdit("name:=USER").Object.focus()
(Note:the above operation can also be achieved using FireEvent method). - Similiarly, for WebEdit one can get some useful information at runtime from the properties like isContentEditable, isMultiLine, ContentEditable, maxlength, etc.
- Use Browser("").Object property to fetch some important information from properties like GoBack, LocationURL, StatusText, ToolBar, StatusBar, etc.
For more information about the Document Object Model, refer to:
http://msdn.microsoft.com/en-us/library/ms533043%28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/aa752127.aspx
No comments:
Post a Comment