Construct a object if I know the object name
Hi,
I have the following call:
Call Aliases.browser.page.formForm0.radiobutton1YearSubscription.ClickButton
where radiobutton1YearSubscription is a radio button in a form. In the same form i have another 2 radio buttons radiobutton2YearSubscription3600 and radiobutton3YearSubscription2400
I want to call the click method after a if statment like this:
If (y="1y") then
BTNy="radiobutton1YearSubscription"
elseif (y="2y") then
BTNy="radiobutton2YearSubscription3600"
elseif (y="3y") then
BTNy="radiobutton3YearSubscription2400"
End If
Call Aliases.browser.page.formForm0.BTNy.ClickButton
How can I construct the object knowing the button names?
Thanks
Hi,
All scripting languages have an equivalent of the evaluate() or eval() function that accepts a string, executes it as code and returns a result.
The code for your case will be like that (VBScript pseudocode that should be adjusted to match the language used in your project):
... BTNy = "radiobutton1YearSubscription" ... strObjAlias = aqString.Format("Aliases.browser.page.formForm0.%s", BTNy) Set oObj = Evaluate(strObjAlias) If (oObj.Exists) Then Call oObj.ClickButton() Else ... End If