Micro Focus QTP (UFT) Forums
Parameterizing Webedit, WebButton, etc - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Parameterizing Webedit, WebButton, etc (/Thread-Parameterizing-Webedit-WebButton-etc)



Parameterizing Webedit, WebButton, etc - rdwaram - 10-23-2009

Hello,
The goal is to make the scripts as robust as possible.
We plan to use this in our Testing env, where code is pushed/changed everyday.

Here is a simple scenario:

Login Screen:

it has any entry for email address and password:
I know that the user entry can be parametrized by data table.

What about the properties of these text boxes.
ex:

Code:
Browser("Login").Page("Login").WebEdit("_email").Set "user1@test.com"
Browser("Login").Page("Login").WebEdit("_password").SetSecure "Password"

Is there a way to parametrize " webedit("_Email") "

If my programmer decides to change the name/property of the textbox, how can i handle this so the script doesnt break?

Please advise.

Thanks,
Rd


RE: Parameterizing Webedit, WebButton, etc - venkatbatchu - 10-23-2009

Hi,
For the first question "Is there a way to parametrize " webedit("_Email") "

I can you give the better solution put all the emails in excel in first column
1. Create the test data i.e, excel with the required input and output
2. Import the datatable using datatable.import
3.eml=datatable.value(1,1)
pwd=datatable.value(2,1)
4. datatable.getrocount and use the loop like (lets say row count=4)
Code:
for i=1 to 4 step 1
datatable.setcurrentrow(1)
Browser("Login").Page("Login").WebEdit("_email").Set eml
Browser("Login").Page("Login").WebEdit"_password").Set pwd
Next

this is the way u can parametrize the things and then for the second question
"If my programmer decides to change the name/property of the textbox, how can i handle this so the script doesnt break?"

It would be better by changing the name and proprties in the script (ctrl+R and replace the new names and properties)
Make sure that u have to write the descriptive programing for the webedit i.e email and password then only u could change the names and properties else
if you proceed with the OR definetly u have change the title and properties in the OR too......