Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Copy actual value or use RandomString generated before
02-01-2012, 04:45 PM
Post: #1
Copy actual value or use RandomString generated before

Hi,

I would appreciate help with copy action or re-use of RandomString in another action. I need to copy actual displayed value or use RandomString I generated before in another action.


I have a code when I generate RandomString (see below)

Action 1

Str1=RandomString(15)
Browser("PROMPT").Page("PROMPT").WebEdit("vin").Set Str1
Str2=RandomString(6)
Browser("PROMPT").Page("PROMPT").WebEdit("regNo").Set Str2
Str3=RandomString(3)
Browser("PROMPT").Page("PROMPT_2").WebEdit("model").Set Str3

Browser("PROMPT").Page("PROMPT_2").WebEdit("make").Set "Volvo"
Browser("PROMPT").Page("PROMPT_2").WebEdit("buildYear").Set "2012"
Browser("PROMPT").Page("PROMPT_2").WebEdit("engineMake").Set "Volvo"
Browser("PROMPT").Page("PROMPT_2").WebEdit("engineModel").Set "V600"
Browser("PROMPT").Page("PROMPT_2").WebEdit("engineHorsePowerRange").Set "600"
Browser("PROMPT").Page("PROMPT_2").WebList("vehicleTypeStr").Select "Truck"
Browser("PROMPT").Page("PROMPT_2").WebButton("Save").Click
Browser("PROMPT").Page("PROMPT_3").WebElement("The maintenance plan is").Check CheckPoint("The maintenance plan is not created until you select Approve._2")

Action 2

In action two I want to repeat the first script from action 1 (just use the same string I generated before)

.Set Str1 does not help at all

Any suggestions?

Thx,
Matt
Find all posts by this user
Quote this message in a reply
02-01-2012, 08:41 PM
Post: #2
RE: Copy actual value or use RandomString generated before
(02-01-2012 04:45 PM)mwietrzyk Wrote:  Hi,

I would appreciate help with copy action or re-use of RandomString in another action. I need to copy actual displayed value or use RandomString I generated before in another action.


I have a code when I generate RandomString (see below)

Action 1

Str1=RandomString(15)
Browser("PROMPT").Page("PROMPT").WebEdit("vin").Set Str1
Str2=RandomString(6)
Browser("PROMPT").Page("PROMPT").WebEdit("regNo").Set Str2
Str3=RandomString(3)
Browser("PROMPT").Page("PROMPT_2").WebEdit("model").Set Str3

Browser("PROMPT").Page("PROMPT_2").WebEdit("make").Set "Volvo"
Browser("PROMPT").Page("PROMPT_2").WebEdit("buildYear").Set "2012"
Browser("PROMPT").Page("PROMPT_2").WebEdit("engineMake").Set "Volvo"
Browser("PROMPT").Page("PROMPT_2").WebEdit("engineModel").Set "V600"
Browser("PROMPT").Page("PROMPT_2").WebEdit("engineHorsePowerRange").Set "600"
Browser("PROMPT").Page("PROMPT_2").WebList("vehicleTypeStr").Select "Truck"
Browser("PROMPT").Page("PROMPT_2").WebButton("Save").Click
Browser("PROMPT").Page("PROMPT_3").WebElement("The maintenance plan is").Check CheckPoint("The maintenance plan is not created until you select Approve._2")

Action 2

In action two I want to repeat the first script from action 1 (just use the same string I generated before)

.Set Str1 does not help at all

Any suggestions?

Thx,
Matt
You may want to read about environment variables. A transcript would be,

In Action 1:

Environment.Value("Str1") = RandomString(15)

In Action 2:

Msgbox Environment.Value("Str1")

Or

Learn about global variables.

Basanth
QTP On Unix- Java Way - Without Putty or Terminal Emulation
You have no idea how high I can fly...
Find all posts by this user
Quote this message in a reply
02-02-2012, 02:34 PM
Post: #3
RE: Copy actual value or use RandomString generated before
(02-01-2012 08:41 PM)basanth27 Wrote:  
(02-01-2012 04:45 PM)mwietrzyk Wrote:  Hi,

I would appreciate help with copy action or re-use of RandomString in another action. I need to copy actual displayed value or use RandomString I generated before in another action.


I have a code when I generate RandomString (see below)

Action 1

Str1=RandomString(15)
Browser("PROMPT").Page("PROMPT").WebEdit("vin").Set Str1
Str2=RandomString(6)
Browser("PROMPT").Page("PROMPT").WebEdit("regNo").Set Str2
Str3=RandomString(3)
Browser("PROMPT").Page("PROMPT_2").WebEdit("model").Set Str3

Browser("PROMPT").Page("PROMPT_2").WebEdit("make").Set "Volvo"
Browser("PROMPT").Page("PROMPT_2").WebEdit("buildYear").Set "2012"
Browser("PROMPT").Page("PROMPT_2").WebEdit("engineMake").Set "Volvo"
Browser("PROMPT").Page("PROMPT_2").WebEdit("engineModel").Set "V600"
Browser("PROMPT").Page("PROMPT_2").WebEdit("engineHorsePowerRange").Set "600"
Browser("PROMPT").Page("PROMPT_2").WebList("vehicleTypeStr").Select "Truck"
Browser("PROMPT").Page("PROMPT_2").WebButton("Save").Click
Browser("PROMPT").Page("PROMPT_3").WebElement("The maintenance plan is").Check CheckPoint("The maintenance plan is not created until you select Approve._2")

Action 2

In action two I want to repeat the first script from action 1 (just use the same string I generated before)

.Set Str1 does not help at all

Any suggestions?

Thx,
Matt
You may want to read about environment variables. A transcript would be,

In Action 1:

Environment.Value("Str1") = RandomString(15)

In Action 2:

Msgbox Environment.Value("Str1")

Or

Learn about global variables.

Thx
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
Sad how to copy webpage into excel using qtp harp 11 4,082 11-24-2011 06:11 AM
Last Post: Saisu
  How to copy a Link name? mv8167 1 552 05-12-2011 06:15 PM
Last Post: Anand
  Issue during call to the copy of action Shama Ahsan 4 1,086 04-13-2011 06:18 PM
Last Post: Shama Ahsan
  Any option to copy/download from HPQC to local path...pls help remya 1 1,299 12-02-2010 11:09 AM
Last Post: cdesserich
Question Copy Object Local to Global Repository A.Saini 2 1,610 10-06-2010 03:38 PM
Last Post: A.Saini

Forum Jump:


User(s) browsing this thread: 1 Guest(s)