How uniqule Identify WebEdit in QTP - QTP9.2 - 01-24-2013
I have an application where 6, 7 edit fields. User can add or delete edit field as well. I want to populate one Edit field against label "ABC".
on normal recording it looks like this:
Code: Browser("User").Page("Field Activity").Frame("FA_TYPE_CHAR").WebEdit("FA_CHAR:1$CHAR_VAL").Click
but if this field (1) at number 2, QTP will popluate this value in wrong field.
How to identify uniquely this field.
Regards,
RE: How uniqule Identify WebEdit in QTP - ssvali - 01-24-2013
Use index property ...
(01-24-2013, 02:19 PM)QTP9.2 Wrote: I have an application where 6, 7 edit fields. User can add or delete edit field as well. I want to populate one Edit field against label "ABC".
on normal recording it looks like this:
Browser("User").Page("Field Activity").Frame("FA_TYPE_CHAR").WebEdit("FA_CHAR:1$CHAR_VAL").Click
but if this field (1) at number 2, QTP will popluate this value in wrong field.
How to identify uniquely this field.
Regards,
RE: How uniqule Identify WebEdit in QTP - QTP9.2 - 01-24-2013
Can you write one liner syntax ... as given in example.
Secondly, index will not be change when order of the field change ?
if one write this
Code: Browser("User").Page("Field Activity").Frame("FA_TYPE_CHAR").WebEdit("FA_CHAR:1$CHAR_VAL").Click
like this
Code: Browser("User").Page("Field Activity").Frame("FA_TYPE_CHAR").WebEdit("FA_CHAR:"&RowNum&"$CHAR_VAL").Click
what does this means
RE: How uniqule Identify WebEdit in QTP - harishshenoy - 01-28-2013
In the above line of code: 'RowNum' has been parameterized or regular expression been used.
i.e u can add the value to the 'RowNum' at the run time like below , it will work for all the values..
Code: RowNum = 1
Browser("User").Page("Field Activity").Frame("FA_TYPE_CHAR").WebEdit("FA_CHAR:"&RowNum&"$CHAR_VAL").Click
this is same as :
Code: Browser("User").Page("Field Activity").Frame("FA_TYPE_CHAR").WebEdit("FA_CHAR:1$CHAR_VAL").Click
Ex2:
Code: RowNum = 2
Browser("User").Page("Field Activity").Frame("FA_TYPE_CHAR").WebEdit("FA_CHAR:"&RowNum&"$CHAR_VAL").Click
this is same as :
Code: Browser("User").Page("Field Activity").Frame("FA_TYPE_CHAR").WebEdit("FA_CHAR:2$CHAR_VAL").Click
other question about INDEX:
Code: Browser("User").Page("Field Activity").Frame("FA_TYPE_CHAR").WebEdit("index:=0").set "your value"
this will set 'your value' into the first text box.
Code: Browser("User").Page("Field Activity").Frame("FA_TYPE_CHAR").WebEdit("index:=1").set "your value"
this is for second text box
Note: indexing starts from 0
Regards,
Harish
|