Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can I use return value of Action1 in other Action2
#2
Not Solved
Hi Ankur,
I have to do this...
' Action1 (Upload Property)
Code:
SystemUtil.Run "iexplore", "http://MyTestingSite.net"
Browser("MyTestingSite").Page("MyTestingSite").Image("MyTestingSite").Click
Browser("MyTestingSite").Page("MyTestingSite_2").Link("ESTATE AGENTS HOME").Click
Browser("MyTestingSite").Page("MyTestingSite_3").WebEdit("UcAgentLogin1$txtAgentName").Set "UserName"
Browser("MyTestingSite").Page("MyTestingSite_3").WebEdit("UcAgentLogin1$txtPassword").Set "Password"
Browser("MyTestingSite").Page("MyTestingSite_3").Image("Login").Click 34,11
Browser("MyTestingSite").Page("MyTestingSite_4").Link("add a new property").Click

Randomize()
propertyID="Property_"&int(100*rnd())

Browser("MyTestingSite").Page("MyTestingSite_5").WebEdit("UcNewPropertyToBuy1$txtPropert").Set propertyID
Browser("MyTestingSite").Page("MyTestingSite_5").WebEdit("UcNewPropertyToBuy1$txtAddress").Set "test"
Browser("MyTestingSite").Page("MyTestingSite_5").WebEdit("UcNewPropertyToBuy1$txtAddress_2").Set "test"
Browser("MyTestingSite").Page("MyTestingSite_5").WebEdit("UcNewPropertyToBuy1$txtTownToB").Set "test"
Browser("MyTestingSite").Page("MyTestingSite_5").WebEdit("UcNewPropertyToBuy1$txtCountyT").Set "test"
Browser("MyTestingSite").Page("MyTestingSite_5").WebList("UcNewPropertyToBuy1$drpRegionT").Select "London"
Browser("MyTestingSite").Page("MyTestingSite_5").WebEdit("UcNewPropertyToBuy1$txtPostCod").Set "BR 123"
Browser("MyTestingSite").Page("MyTestingSite_5").WebEdit("UcNewPropertyToBuy1$txtPropert_2").Set "Property Summary"
Browser("MyTestingSite").Page("MyTestingSite_5").WebEdit("UcNewPropertyToBuy1$txtDisplay").Set "Display Address"
Browser("MyTestingSite").Page("MyTestingSite_5").WebFile("UcNewPropertyToBuy1$Upload6").Set "file://path/image.jpg"
Browser("MyTestingSite").Page("MyTestingSite_5").WebEdit("UcNewPropertyToBuy1$MainImageT").Set "Image title"
Browser("MyTestingSite").Page("MyTestingSite_5").WebCheckBox("UcNewPropertyToBuy1$ckbSubmit").Set "ON"
Browser("MyTestingSite").Page("MyTestingSite_5").Image("UcNewPropertyToBuy1$btnSaveToB").Click 68,12
Browser("MyTestingSite").Page("MyTestingSite_6").Check CheckPoint("MyTestingSite")
Browser("MyTestingSite").Page("MyTestingSite_6").Link("Return home").Click
'---------------------------------------------------------------
Here I want to use the Property id as the return value for this Action1 so that I can use it in the Action2 to find out the property, and do some task with that property.
---------------------------------------------------------------

'Action2 (Publish Property)
Code:
RunAction "Copy of UploadProperty", oneIteration

SystemUtil.Run "iexplore","http://MyTestingSite.net/admin"
Browser("MyTestingSite").Page("MyTestingSite").WebEdit("txtusername").Set "UserName"
Browser("MyTestingSite").Page("MyTestingSite").WebEdit("txtpassword").Set "Password"
Browser("MyTestingSite").Page("MyTestingSiteS").WebButton("Login").Click
Browser("MyTestingSite").Page("MyTestingSite_2").Image("properties").Click
wait (2)

Dim row,i,strProperty,lnkImg

'+++++"I want here the return value of action1 i.e. the ProprtyToBePublish"++++++
ProprtyToBePublish = ??????????????? 'return value from action1
'++++"I want here the return value of action1 i.e. the ProprtyToBePublish"++++

msgbox ProprtyToBePublish
row = Browser("MyTestingSite").Page("MyTestingSite_2").Frame("Frame").WebTable("1").GetRowWithCellText(ProprtyToBePublish)
msgbox row
set lnkImg=Browser("MyTestingSite").Page("MyTestingSite_2").Frame("Frame").WebTable("1").ChildItem(row,5,"WebElement",0)
lnkImg.Click
Browser("MyTestingSite").Page("MyTestingSite").Frame("Frame_2").WebCheckBox("chkIsPublished").Set "ON"
Browser("MyTestingSite").Page("MyTestingSite").Frame("Frame_2").Link("Save Property").Click
--------------------
Also need to know If I can optimize some qtp script here.
Reply


Messages In This Thread
RE: Can I use return value of Action1 in other Action2 - by yugal - 12-30-2008, 01:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Childobject return wrong checkbox count.. VpnQTP 1 2,862 04-09-2015, 09:07 PM
Last Post: babu123
  SQL on oracle database doesn't return a value Bluefields 2 3,251 07-09-2012, 01:23 PM
Last Post: Bluefields
  Return reusable object HelenN 0 4,398 04-20-2011, 08:31 PM
Last Post: HelenN
  VBScript - How to get the Function return value iamsekhar 2 22,752 09-13-2010, 04:16 PM
Last Post: lotos
  How to return multiple values from QTP User defined function dineshb 11 31,456 12-04-2009, 06:22 PM
Last Post: nil

Forum Jump:


Users browsing this thread: 1 Guest(s)