Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can i Give Variable in Object name ???
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi All,

I have to iterate the following code.

Code:
Browser("Browser").Page("User").Frame("actionIFrame").WebButton("WebButton_2").Click
        Wait(3)
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$").Set BusinessName
        wait(2)
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_2").Set EmpCount
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_3").Set VolNumber
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_4").Set LegStrctr
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_5").Set BAddLine1
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_6").Set BAddLine2
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_7").Set BStreetName
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_8").Set BCityID
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_9").Set BCityName
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_10").Set BStateName
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_11").Set BCountryCd
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_12").Set PostalCd
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_13").Set BAddType
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_14").Set  BWorkNumber
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_15").Set BHomeNumber
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_16").Set BCellNumber
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_17").Set BEmail1
        Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$l1$_18").Set BEmail2
        wait(1)
        Browser("Browser").Page("User").Frame("actionIFrame").WebButton("WebButton_3").Click
        Wait(3)
        Browser("Browser").Page("User").Frame("actionIFrame").WebList("$PpyWorkPage$pBusinessList$l1$").Select 1

that is i have to click a
Code:
button([color=#FF0000]Browser("Browser").Page("User").Frame("actionIFrame").WebButton("WebButton_2").Click[/color])
each time, then a new frame will be created with same fields in the old frame. so the object name of new ly created fileds will be like

Code:
Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$[b]l2[/b]$").Set BusinessName

instead of

Code:
Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("$PpyWorkPage$pBusinessList$[b]l1[/b]$").Set BusinessName.

so in iteration how can i change the Name if the Object.That is i need Syntax for giving variable in object name.
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Try this
Code:
strObjectName="$PpyWorkPage$pBusinessList$"&[b]<enter dynamic value
which is changing, here l2>[/b]&"$"
Code:
Browser("Browser").Page("User").Frame("actionIFrame").WebEdit("name:="&strObjectName).Click

Regards,
Ankesh
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi,

If you are saving all the objects in OR, then you can iterate your code for all the frames by giving variable in your object name.

Regards,
Surya
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  This code does not give total no of links present on page plz help it returns 0 excellentpawan 8 5,638 01-17-2015, 07:49 PM
Last Post: yogi4tech
  How to give comma seprator when RS is returned multiple results? prasannadr 0 1,860 03-29-2012, 12:56 PM
Last Post: prasannadr
  Assigning SystemUtil.Run object to a variable rahul29 0 2,560 02-09-2012, 10:16 PM
Last Post: rahul29
  How to give the file name dynamically using variable name vnsk 4 6,039 10-13-2011, 09:07 AM
Last Post: vnsk
  How to give the For Loop for 3 work sheets? Uma 1 2,939 09-10-2011, 06:54 PM
Last Post: Uma

Forum Jump:


Users browsing this thread: 1 Guest(s)