GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  QTP
Go To First  |  Previous Question  |  Next Question 
 QTP  |  Question 11 of 674    Print  
Hi All,

my Object name is "Login".

my code is:

browser("B1").page("P1").WebEdit("Login").Set "Admin"


CAN I USE IT LIKE THIS?

myObj = "Login"
browser("B1").page("P1").WenEdit (myObj).Set "Admin"


It is not working. How to do in this situation?

  
Total Answers and Comments: 11 Last Update: February 28, 2008     Asked by: Nagelli Anil Kumar 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
  Sorting Options  
  Page 1 of 2   « First    1    2    >     Last »  
March 30, 2006 08:55:50   #1  
Nag        

RE: Hi All,my Object name is "Login".

Hi

I don't find any problem with your script. I tried to run the same sort of script in my system I didn t find any errors.

login username
Browser( Welcome: Mercury Tours ).Page( Welcome: Mercury Tours ).WebEdit(login).Set xyz

Thanks

Nag


 
Is this answer useful? Yes | No
March 30, 2006 10:34:44   #2  
nagasenan Member Since: March 2006   Contribution: 4    

RE: Hi All,my Object name is "Login".

Hi

There is nothing wrong with your script but I found a small syntax error.

myObj Login
browser( B1 ).page( P1 ).WenEdit (myObj).Set Admin

It has to be WinEdit insted of WenEdit.

Nag


 
Is this answer useful? Yes | No
April 04, 2006 01:49:37   #3  
Rupesh        

RE: Hi All,my Object name is "Login".

There are 2 problems with your script

1) rather than just specifying myObj Login it is more robust if ur code would have been like this

myobj name: Login

this is called descriptive programming . here we are telling the QTP to find an Webedit box which has the Name property value which is equal to Logine. if you start programming in this way . u dont even need an entry in the OR.

try deleting this entry in OR and run the scipt.

this wil make your overall script light and easier to load however execution time is slightly increased.

2) the second flaw i think was a typo in your code the web edit box is speeled as wenedit.

Keep smiling


 
Is this answer useful? Yes | No
April 10, 2006 02:41:12   #4  
Ravia        

RE: Hi All,my Object name is "Login".
It can also be done by renaming the object name in ur OR. By renaming the object name in the OR would be more convinient as it would be reflected in all ur scripts wherever the object has been used at its own.






 
Is this answer useful? Yes | No
March 29, 2007 01:15:57   #5  
Ijaz        

RE: Hi All,my Object name is "Login".

Hi

You try this one

myObj( name ).value Login

browser( B1 ).page( P1 ).WenEdit (myObj).Set Admin


OR

You try this one also

myObj( text ).value Login

browser( B1 ).page( P1 ).WenEdit (myObj).Set Admin

Note: Check out the property of that object in Object Repository and according to set that value then it's work definately. Check in OR and afterwards delete that OR.
Ok
Bye

If you have any query mail me


 
Is this answer useful? Yes | No
October 09, 2007 06:27:21   #6  
lahari1259 Member Since: October 2007   Contribution: 2    

RE: Hi All,my Object name is "Login".
for assigning objects to variables you can use set method...

Set myobj browser("B1").page("P1").WebEdit("Login")
myobj.Set "Admin"


Try this code... this will work..

 
Is this answer useful? Yes | No
October 09, 2007 06:41:30   #7  
fayaz0535 Member Since: June 2007   Contribution: 4    

RE: Hi All,my Object name is "Login".
The best way i think is to use the below script:

set Login_Username Browser("B1").Page("P1").WebEdit("Login")

Login_Username.set "Admin"


this works fine...

i have one doubt in ur script tell me whats the value of myobj

is it just Login

or

"Login"

i.e Login with double quotes...

reply soon

 
Is this answer useful? Yes | No
February 25, 2008 08:18:19   #8  
ramupalanki Member Since: December 2007   Contribution: 10    

RE: Hi All,my Object name is "Login".my code is:browser("B1").page("P1").WebEdit("Login").Set "Admin"CAN I USE IT LIKE THIS?myObj = "Login"browser("B1").page("P1").WenEdit (myObj).Set "Admin"It is not working. How to do in this situation?
Set myObj Description.Create
BrowserObj("name").Value "Login"

browser("B1").page("P1").WebEdit(myobj).Set "Admin"

I think it will work properly


 
Is this answer useful? Yes | No
February 25, 2008 08:19:10   #9  
ramupalanki Member Since: December 2007   Contribution: 10    

RE: Hi All,my Object name is "Login".my code is:browser("B1").page("P1").WebEdit("Login").Set "Admin"CAN I USE IT LIKE THIS?myObj = "Login"browser("B1").page("P1").WenEdit (myObj).Set "Admin"It is not working. How to do in this situation?
sorry for the mistake

Set myObj Description.Create
myObj("name").Value "Login"

browser("B1").page("P1").WebEdit(myobj).Set "Admin"

I think it will work properly

 
Is this answer useful? Yes | No
February 28, 2008 02:37:34   #10  
kavitamurala Member Since: February 2008   Contribution: 5    

RE: Hi All,my Object name is "Login".my code is:browser("B1").page("P1").WebEdit("Login").Set "Admin"CAN I USE IT LIKE THIS?myObj = "Login"browser("B1").page("P1").WenEdit (myObj).Set "Admin"It is not working. How to do in this situation?

Hi

Your script is okie but it got a small misteke. i.e you are assigning ur object to some variable and u r using that var insted of that u do like this


set myobj "Login"
Browser("B1").page("P1").WebEdit(myobj).set "Admin"


U try this one I hope u got it.

Thank u.



 
Is this answer useful? Yes | No
  Page 1 of 2   « First    1    2    >     Last »  


 
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