12-02-2010, 12:16 PM
First, the reason you are getting the error is that the line:
has "=" after the .Set. It should be:
However, if the the WebEdit really is read-only, you will still get an error (just one that says that the object is disabled). If you can capture the WebTable or WebElement that represents the calendar picker when it is open, you can click a child of it with descriptive programming. For this example, assume the calendar is a WebTable called "Calendar" and the days are TDs inside the table. If this is the case you will probably have to differentiate between the "disabled" days and the "enabled" days of the month. Almost always the class attribute is different. Assume the TDs that are "enabled" have the class attribute value of "validDays" that will uniquely identify the enabled "1" as opposed to the disabled "1" at the bottom of the calendar. The Date function (as opposed to the Now function) gets today's date without time.
Again, this code won't actually run in your test, you will have to capture the calendar and figure out what makes the enabled days different from the disabled days. I am just trying to give you an idea on how to tackle the problem.
Code:
Browser("MyPurolator Login - Purolator").Page("Purolator E-Ship Online").WebEdit(var_date).Set = "2010-12-09"
has "=" after the .Set. It should be:
Code:
Browser("MyPurolator Login - Purolator").Page("Purolator E-Ship Online").WebEdit("ServiceDate").Set "2010-12-09"
However, if the the WebEdit really is read-only, you will still get an error (just one that says that the object is disabled). If you can capture the WebTable or WebElement that represents the calendar picker when it is open, you can click a child of it with descriptive programming. For this example, assume the calendar is a WebTable called "Calendar" and the days are TDs inside the table. If this is the case you will probably have to differentiate between the "disabled" days and the "enabled" days of the month. Almost always the class attribute is different. Assume the TDs that are "enabled" have the class attribute value of "validDays" that will uniquely identify the enabled "1" as opposed to the disabled "1" at the bottom of the calendar. The Date function (as opposed to the Now function) gets today's date without time.
Code:
'Code to click the button or image that opens the calendar e.g.:
'Browser("MyPurolator Login - Purolator").Page("Purolator E-Ship Online").Image("Calendar Button Image").Click
Browser("MyPurolator Login - Purolator").Page("Purolator E-Ship Online").WebTable("Calendar").WebElement("html tag:=TD", "class:=validDays", "innertext:=" & Day(Date)).Click
Again, this code won't actually run in your test, you will have to capture the calendar and figure out what makes the enabled days different from the disabled days. I am just trying to give you an idea on how to tackle the problem.