Diffrent ways to write a statement
- 'Examples on how to click a button in 7 ways
- '###################
- '#### 1st method ####
- '###################
- 'Common Method
- Window("Flight Reservation").WinButton("Update Order").Click
- '###################
- '#### 2nd method ####
- '###################
- ' Assigning window object to an object variable
- Set wndObject=Window("Flight Reservation")
- ' Following normal syntax ( click on a button)
- wndObject.WinButton("Update Order").Click
- ' OR
- ' Assigning Button object to an object variable
- Set btnObject=Window("Flight Reservation").WinButton("Update Order")
- ' Clicking on button using button object variable
- btnObject.Click
- '###################
- '#### 3rd method ####
- '###################
- ' Using With statement
- With Window("Flight Reservation")
- .WinButton("Update Order").click
- End with
- '###################
- '#### 4th method ####
- '###################
- ' Descriptive programming
- Window("text:=Flight Reservation").WinButton("text:=&Update Order").Click
- '###################
- '#### 5th method ####
- '###################
- ' creating a description object
- Set oDes=Description.Create
- ' assigning description to the description object
- oDes("nativeclass").value="Button"
- oDes("text").value="&Update Order"
- ' clicking on button using the created description object
- Window("text:=Flight Reservation").winbutton(oDes).click
- '###################
- '#### 6th method ####
- '###################
- ' creating a description object
- Set oDes=Description.Create
- ' Flitering the objects
- set btnObjList=Window("text:=Flight Reservation").ChildObjects(oDes)
- For objIndex=0 to btnObjList.count-1
- ' Get property value from object
- propVal=btnObjList(objIndex).getroproperty("text")
- ' Compare property value
- If propVal="&Update Order" Then
- ' Click on identified object
- btnObjList(objIndex).click
- ' Exit For loop after clicking on the button
- Exit for
- End If
- Next
- '###################
- '#### 7th method ####
- '###################
- ' Assigning window object description to a constant
- Public const wndFlight="text:=Flight Reservation"
- ' Assigning Button object description to a constant
- Public const btnUpdate="text:=&Update Order"
- ' Click on a button using description constants
- Window(wndFlight).winbutton(btnUpdate).click
0 comments:
Post a Comment