Manually editing a macro file if automatic recording fails
Posted: Thu Oct 16, 2008 2:12 pm
Some websites contain tricky AJAX elements that are not supported by the automatic recording.
So if you record a macro and replay fails, there are generally two options:
1. Re-record the problem element in DirectScreenmode
2. Edit the automatically generated macro file.
This post focuses on #2:
We try to reserve a car at hertz.es and record it. This is the automatically generated macro:
URL GOTO=http://www.hertz.es/rentacar/index.jsp? ... mepage.jsp
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:resForm ATTR=ID:pickupLocation CONTENT=ma
TAG POS=1 TYPE=DIV ATTR=TXT:MAD,Madrid<SP>Airport,Madrid,España
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:resForm ATTR=ID:day1Pos CONTENT=11
TAG POS=1 TYPE=TD ATTR=TXT:22
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:resForm ATTR=ID:day2Pos CONTENT=
TAG POS=4 TYPE=TD ATTR=TXT:29
TAG POS=1 TYPE=DIV ATTR=ID:reserveItButton
The red lines do not work during replay, because the AJAX/Javascript popups like the calendar control do not open. With DirectScreen clicks we can force them to open, but since our goal is "only" to reserve a car (= web automation, not testing the calendar control), we decide to fill in the fields directly.
How to edit the macro:
1. We remove the lines that cause the error (marked red above)
2. We add the required information directly to the macro (marked green below)
URL GOTO=http://www.hertz.es/rentacar/index.jsp? ... mepage.jsp
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:resForm ATTR=ID:pickupLocation CONTENT=MAD,Madrid<SP>Airport,Madrid,España
'TAG POS=1 TYPE=DIV ATTR=TXT:MAD,Madrid<SP>Airport,Madrid,España
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:resForm ATTR=ID:day1Pos CONTENT=22/10/2008
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:resForm ATTR=ID:day2Pos CONTENT=10/29/2008
TAG POS=1 TYPE=DIV ATTR=ID:reserveItButton
Voila! The second macro works
So if you record a macro and replay fails, there are generally two options:
1. Re-record the problem element in DirectScreenmode
2. Edit the automatically generated macro file.
This post focuses on #2:
We try to reserve a car at hertz.es and record it. This is the automatically generated macro:
URL GOTO=http://www.hertz.es/rentacar/index.jsp? ... mepage.jsp
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:resForm ATTR=ID:pickupLocation CONTENT=ma
TAG POS=1 TYPE=DIV ATTR=TXT:MAD,Madrid<SP>Airport,Madrid,España
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:resForm ATTR=ID:day1Pos CONTENT=11
TAG POS=1 TYPE=TD ATTR=TXT:22
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:resForm ATTR=ID:day2Pos CONTENT=
TAG POS=4 TYPE=TD ATTR=TXT:29
TAG POS=1 TYPE=DIV ATTR=ID:reserveItButton
The red lines do not work during replay, because the AJAX/Javascript popups like the calendar control do not open. With DirectScreen clicks we can force them to open, but since our goal is "only" to reserve a car (= web automation, not testing the calendar control), we decide to fill in the fields directly.
How to edit the macro:
1. We remove the lines that cause the error (marked red above)
2. We add the required information directly to the macro (marked green below)
URL GOTO=http://www.hertz.es/rentacar/index.jsp? ... mepage.jsp
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:resForm ATTR=ID:pickupLocation CONTENT=MAD,Madrid<SP>Airport,Madrid,España
'TAG POS=1 TYPE=DIV ATTR=TXT:MAD,Madrid<SP>Airport,Madrid,España
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:resForm ATTR=ID:day1Pos CONTENT=22/10/2008
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:resForm ATTR=ID:day2Pos CONTENT=10/29/2008
TAG POS=1 TYPE=DIV ATTR=ID:reserveItButton
Voila! The second macro works