GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  QTP
Go To First  |  Previous Question  |  Next Question 
 QTP  |  Question 9 of 674    Print  
I have 10 Edit Boxes in my application. i Named them as Text1, Text2, Text3...Text10. Now i want to set values in these Text Boxes using Loop Statement. Can i Use

for i=0 to 10
browser("b1").page("p1").WebEdit("Text" & i).set "value" &i
next

**********

Is it acceptable WebEdit("Text"&i) ? I am getting error here.
Any suggestions?


  
Total Answers and Comments: 6 Last Update: November 08, 2007     Asked by: Nagelli Anil Kumar 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
March 30, 2006 10:59:02   #1  
nagasenan Member Since: March 2006   Contribution: 4    

RE: I have 10 Edit Boxes in my application. i Named t...

Hi

It is 100 acceptable.

Here is the sample script which runs perfect.

For i 1 to 2

Browser( Welcome: Mercury Tours ).Page( Book a Flight: Mercury ).WebEdit( text & i).Set name & i

Next


 
Is this answer useful? Yes | No
April 04, 2006 02:00:05   #2  
rupesh        

RE: I have 10 Edit Boxes in my application. i Named t...

use descriptive programming in this situation in following way.

Assuming text is the name property by which QTP is identifying the webedit box:

box name: Text & i

for i 0 to 10
browser( b1 ).page( p1 ).WebEdit(box).set value &i
next


 
Is this answer useful? Yes | No
December 19, 2006 06:01:56   #3  
Kaivalya        

RE: I have 10 Edit Boxes in my application. i Named t...

Hi

The idea is correct but implementation is wrong.

for i 0 to 10

*///browser( b1 ).page( p1 ).WebEdit( Text & i).set value &i///*

Statment is not write.

You should use descriptive programming like this

browser( b1 ).page( p1 ).WebEdit(name: Text & i).set

Supposing name is property


next


 
Is this answer useful? Yes | No
April 17, 2007 07:41:40   #4  
debleena23 Member Since: April 2007   Contribution: 159    

RE: I have 10 Edit Boxes in my application. i Named t...

Hi

If you want to use descriptive programming then inyour case "Test1" "Text2".... are of "name" property. The other unique property can be "index"

For i 0 to 9

Browser("b1").Page("p1").WebEdit(name: "Text1" "index: " & i).Set Value


 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
April 17, 2007 08:33:48   #5  
CRC        

This is 100% correct code for your question
Dim a i

Window( Program Manager ).WinListView(SysListView32).Activate text htmt

for i 1 to 10 step 1

a inputbox ( Enter the Text )

Browser( BrowserName ).Page( PageName ).WebEdit( name: text &i).Set a

Next

 
Is this answer useful? Yes | No
November 07, 2007 17:24:18   #6  
harinder p singh        

RE: I have 10 Edit Boxes in my application. i Named t...
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("text" & i).Set "name" & iNextHere objects need to be present in the OR

FOr the below one

For i 1 to 2Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("text" & i).Set "name" & i
Next
Here no objects needed to be present in the OR


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape