Micro Focus QTP (UFT) Forums
SETTOPROPERTY - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: SETTOPROPERTY (/Thread-SETTOPROPERTY)



SETTOPROPERTY - rajeshdizzy - 07-09-2009

Hi all..
I used settoproperty of a yahoomail login,i wrote the script which i have referred from other blogs.....may i know is this script is correct,becoz when i run the application i getting error in the 1st line itself....pls suggest me the correct solution for SETTOPROPERTY...




Code:
browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").WebEdit("login").type "rajeshdizzy"
browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").WebEdit("login").SetTOProperty "title","password"
browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").WebEdit("passwd").SetSecure "xxxxxxx"
browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").WebButton("Sign In").Click



Thankz
L.Rajesh


RE: SETTOPROPERTY - Eazy007 - 07-09-2009

You say it's the first line where the error occurs... if this is so, try replacing 'type' with 'set'. Then see what happens if it gets to the second line.


RE: SETTOPROPERTY - rajeshdizzy - 07-09-2009

Its not working still error appears....
Code:
Sub setToproperty
dialog("Login").WinEdit("Agent Name:").SetTOProperty "attached text","password"
dialog("Login").WinEdit("password").SetSecure "mercury"
End Sub


which one is the correct syntax? the one which i have posted or previous one...pls clear me with an example


RE: SETTOPROPERTY - supputuri - 07-09-2009

Hi Rajesh,

I think you know the basic use with 'SetToProperty' (Which will set the Test Object property with user defined property) and one more thing we have to keep in mind is this will work/show affect only in that particular run (but not affect/chage the Test Object properties in OR).
Here i have taken the Google page for example:

Please open Google page and add "Google Search Edit box" to the OR and then execute the following LOC.

Code:
'This will return the name property value of Google Search editbox ("q")
msgbox Browser("Google").Page("Google").WebEdit("q").GetTOProperty("name")
'This will set the property value.
Browser("Google").Page("Google").WebEdit("q").SetToProperty "name","GoogleSearchBox"
'This will validate the changes that we have made to the name property
msgbox Browser("Google").Page("Google").WebEdit("q").GetTOProperty("name")

Pls check out the property of Web edit before and after the execution (It will be the same in OR).

Let me know if you need any more info.

Thanks,
Sridhar


RE: SETTOPROPERTY - rajeshdizzy - 07-09-2009

Code:
Browser("Google").Page("Google").WebEdit("q").SetToProperty "name","GoogleSearchBox"
in this example,i dont understand where u r getting the "GoogleSearchBox".is tat the value from Obj rep or userdefined(anything can be defined)can u give one more example...


RE: SETTOPROPERTY - supputuri - 07-09-2009

Yup Rajesh,

Code:
Browser("Google").Page("Google").WebEdit("q").SetToProperty "name","Enter the UserDefine the value here"
Anyhow we will see one more example for your understanding:
'First checkout the property value in OR for
Code:
"Agent Name:" edit box.
msgbox Dialog("Login").WinEdit("Agent Name:").GetTOProperty("attached text")
Dialog("Login").WinEdit("Agent Name:").Highlight
'Now setting the value in Agent Name edit box.
Code:
Dialog("Login").WinEdit("Agent Name:").Set "QTPKING"
'Now i want to set the password in the "Password:" edit box which is not added in the OR.
'I can do it by changing the objct propery value in OR in runtime by using SetTOProperty.
'****
'Assigning the Password attached text proptery (="Password:") to Agent Name.
Code:
Dialog("Login").WinEdit("Agent Name:").SetTOProperty "attached text","Password:"
msgbox Dialog("Login").WinEdit("Agent Name:").GetTOProperty("attached text")
'It will highlight the password field
Code:
Dialog("Login").WinEdit("Agent Name:").Highlight
'Enter the password now.
Code:
Dialog("Login").WinEdit("Agent Name:").Set "Mercury"

Let me know if you need any thing else.
Thanks,
QTPKing


RE: SETTOPROPERTY - rajeshdizzy - 07-10-2009

Its working....
Thankz sridhar....