* Checks the balance of a gift card
* Extracts that balance into a spreadsheet
I'm using a 3 column CSV (datasource):
* Card #
* Exp date
* PIN
A new tab is opened for each line of datasource.
I would like to extract the balance into the original datasource, so that the new CSV would have 4 columns:
* Card #
* Exp date
* PIN
* Balance
I know I could extract it into a separate CSV, then paste it back into my original datasource, but I'd prefer to skip this extra step and have everything in one file.
Here is the incomplete code so far; I haven't added a destination for the extraction yet, b/c I'm hoping to add it back to the datasource - if that's even possible.
Code: Select all
VERSION BUILD=5010424 RECORDER=CR
' Check the balance of a Simon Gift Card. Prompts for the Captcha, submits and opens a new tab to check the next gift card balance.
' This method is useful if you have a # of cards to check: the balance will load in the background as another tab opens and checks the next card.
' Once it finishes the spreadsheet, visit each tab to see the balance on your card.
' Feel free to modify and adapt this script.
SET !DATASOURCE SimonGiftCards.csv
SET !DATASOURCE_COLUMNS 3
SET !VAR1 2
SET !LOOP {{!VAR1}}
SET !DATASOURCE_LINE {{!LOOP}}
SET !ERRORIGNORE YES
URL GOTO=https://www.simon.com/giftcard/card_balance.aspx
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_FullContent_MainContent_tbNumber CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_FullContent_MainContent_tbExpDate CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_FullContent_MainContent_tbCid CONTENT={{!COL3}}
' The Captcha was covered by the dialog box, so added a new position tag to move the webpage back to the top.
TAG POS=1 TYPE=SECTION ATTR=TXT:The<SP>Simon<SP>Giftcard®<SP>Gift<SP>Card<SP>Corporate<SP>Sa*
PROMPT "Captcha:" !VAR3
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_FullContent_MainContent_CaptchaCodeTextBox CONTENT={{!VAR3}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_FullContent_MainContent_checkBalanceSubmit
' Wait for the results page to open with the balance of the gift card.
WAIT SECONDS=20
' Extract the balance of the gift card
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_FullContent_MainContent_lblBalance EXTRACT=TXT
WAIT SECONDS=20
TAB OPEN
TAB T={{!LOOP}}
SET !VAR2 {{!LOOP}}
ADD !VAR2 -{{!VAR1}}
ADD !VAR2 2
TAB T={{!VAR2}}
VERSION BUILD=5010424 RECORDER=CR
Mac OS X 10.12.3 (16D32)
Chrome Version 56.0.2924.87 (64-bit) - also use Chrome Canary and Firefox
Included demos work