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?

Showing Answers 1 - 28 of 28 Answers

Nag

  • Mar 30th, 2006
 

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

  Was this answer useful?  Yes

nagasenan

  • Mar 30th, 2006
 

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

  Was this answer useful?  Yes

Rupesh

  • Apr 4th, 2006
 

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

  Was this answer useful?  Yes

Ravia

  • Apr 10th, 2006
 

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.  Happy 





  Was this answer useful?  Yes

Ijaz

  • Mar 29th, 2007
 

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

  Was this answer useful?  Yes

lahari1259

  • Oct 9th, 2007
 

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..

  Was this answer useful?  Yes

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

  Was this answer useful?  Yes

ramupalanki

  • Feb 25th, 2008
 

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

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

I think it will work properly

  Was this answer useful?  Yes

ramupalanki

  • Feb 25th, 2008
 

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

  Was this answer useful?  Yes

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.


   

  Was this answer useful?  Yes

seemadaduti

  • Sep 13th, 2010
 

You cant store a Logical name in a Veriable, if you want to chage the logicalname then you go to Objectrepository and change that "Login" to "myObj"
Then you execute this script

Thanks

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions