Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SETTOPROPERTY
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
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
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
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.
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
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
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
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
Reply
#5
Solved: 10 Years, 8 Months, 3 Weeks ago
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...
Reply
#6
Solved: 10 Years, 8 Months, 3 Weeks ago
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
Reply
#7
Solved: 10 Years, 8 Months, 3 Weeks ago
Its working....
Thankz sridhar....
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  The SetTOProperty on an object is n ot working... shibinp 0 2,937 09-02-2011, 06:39 PM
Last Post: shibinp
  Object required on SetToProperty zerocool 1 4,674 12-02-2010, 01:03 PM
Last Post: cdesserich

Forum Jump:


Users browsing this thread: 1 Guest(s)