When you work with Web applications and Web pages, use the following operations to perform deeper testing.
In the Editor, you can use the Object property to activate the method for a Web object. Activating the method for a Web object has the following syntax:
For example, suppose you have the following statement in your script:
document.MyForm.MyHiddenField.value = "My New Text"
The following example achieves the same thing by using the Object property, where MyDoc is the DOM's document:
Dim MyDoc Set MyDoc = Browser(browser_name).page(page_name).Object MyDoc.MyForm.MyHiddenField.value = "My New Text"
In the following example, LinksCollecton is assigned to the link collection of the page through the Object property. Then, a message box opens for each of the links, with its innerHTML text.
Dim LinksCollection, link Set LinksCollection = Browser(browser_name).Page(page_name).Object.links For Each link in LinksCollection MsgBox link.innerHTML Next
For a list of a Web object's internal properties and methods, see: http://msdn2.microsoft.com/en-us/library/ms531073.aspx
When UFT One recognizes an object as a Web-based object that does not fit into any other UFT One test object class, it learns the object as a WebElement object. You can also use a programmatic description with a WebElement test object to perform methods on any Web object in your Web site.
For example, when you run either of the examples below, UFT One clicks the Web object in the Advantage Online Shopping page with the name SIGN IN.
Browser("Advantage Shopping").Page("Advantage Shopping").WebElement("name:=SIGN IN", "type:=button").Click
Set WebObjDesc = Description.Create() WebObjDesc("name").Value = "SIGN IN" WebObjDesc("type").Value = "button" Browser("Advantage Shopping").Page("Advantage Shopping").WebElement(WebObjDesc).Click