12-01-2010, 09:00 PM
Hello Experts,
I'm new to QTP and trying to write a Script. This script requires to change value (date) in a Readonly Textbox. I'm not sure how to accomplish this task. I've tried to set it's value with the following code but having error.
For refer here is code
-----------------------------------------------------------
-----------------------------------------------------------
And Here is the Error message i'm getting when code reaches the last line.
----------------------------------------------------------
----------------------------------------------------------
Some back ground on this issue as some of you might think what's the need to set value in read-only field.
The problem is it's a Calendar Field. A button is associated with it. Itself Calendar text box is read only. You click on this button beside this read-only field which shows Calendar drop down. The you choose a day number say 3, 5, 18 and so on. This Calendar read-only text field always show field by default date 1 week in advance. So user has to choose from Calendar Drop down to select today's date. I try to automate the process to click on this button and then choose the numbers(date). But the problem is these day's are 'Webelement'. Also if I start capturing them then I've to hold all 30 day's Webelements in OB. So I'm trying to come up with some way that I can use NOW() function to get today's date day and plug in this field.
For reference I've also attached a screen shot of this field and Calendar Drop down.
I hope this detail give you and others some idea. Can please someone show me how to do it?
Many thanks in advance.
I'm new to QTP and trying to write a Script. This script requires to change value (date) in a Readonly Textbox. I'm not sure how to accomplish this task. I've tried to set it's value with the following code but having error.
For refer here is code
-----------------------------------------------------------
Code:
Set var_date = Browser("MyPurolator Login - Purolator").Page("Purolator E-Ship Online").WebEdit("ServiceDate")
MsgBox var_date.GetTOProperty("default value")
var_date.SetTOProperty "default value", "2010-12-02"
MsgBox var_date.GetTOProperty ("default value")
Browser("MyPurolator Login - Purolator").Page("Purolator E-Ship Online").WebEdit(var_date).Set = "2010-12-09"
And Here is the Error message i'm getting when code reaches the last line.
----------------------------------------------------------
Code:
Run Error Object doesn't support this property or method: 'Browser(...).Page(...).WebEdit(...).Set'
Line (126): "Browser("MyPurolator Login - Purolator").Page("Purolator E-Ship Online").WebEdit(var_date).Set = "2010-12-09"".
Some back ground on this issue as some of you might think what's the need to set value in read-only field.
The problem is it's a Calendar Field. A button is associated with it. Itself Calendar text box is read only. You click on this button beside this read-only field which shows Calendar drop down. The you choose a day number say 3, 5, 18 and so on. This Calendar read-only text field always show field by default date 1 week in advance. So user has to choose from Calendar Drop down to select today's date. I try to automate the process to click on this button and then choose the numbers(date). But the problem is these day's are 'Webelement'. Also if I start capturing them then I've to hold all 30 day's Webelements in OB. So I'm trying to come up with some way that I can use NOW() function to get today's date day and plug in this field.
For reference I've also attached a screen shot of this field and Calendar Drop down.
I hope this detail give you and others some idea. Can please someone show me how to do it?
Many thanks in advance.