Reputation: 13
I am trying to get iMacros to open a link in a new tab. My current code is:
VERSION BUILD=8970419 RECORDER=FX
SET !EXTRACT_TEST_POPUP NO
SET !ERRORIGNORE YES
TAB T=1
TAG POS=1 TYPE=DIV ATTR=ITEMPROP:name&&CLASS:product-card__description **EXTRACT=HTML**
TAB OPEN NEW
TAB T=2
**URL GOTO={{!EXTRACT}}**
TAG POS=1 TYPE=BUTTON ATTR=CLASS:"loading-spinner-btn button button--primary add-to-cart-button"
However when I run the code, it does everything except open the new tab with extracted URL in the ITEMPROP
TAG. Please help, I will even donate to you through paypal if I can get this resolved.
Note: I have tried extract=html/href/htm
none seem to work.
Upvotes: 1
Views: 7482
Reputation: 1158
I hope this code might help you.
SET !TIMEOUT 200
SET !TIMEOUT_STEP 0
SET !ERRORIGNORE YES
SET !EXTRACT_TEST_POPUP NO
TAB T=1
'This Extracts HREF by XPATH'
TAG XPATH="//div[@itemporp='name'][@class='product-card__description']//a[1]" EXTRACT=HREF
TAB OPEN
TAB T=2
URL GOTO={{!EXTRACT}}
WAIT SECONDS=1
'Spaces in attributes has to be replaced by <SP>'
TAG POS=1 TYPE=BUTTON ATTR=CLASS:loading-spinner-btn<SP>button<SP>button--primary<SP>add-to-cart-button
I assumed there is link inside div tag which you are trying to extract and load in new tab.
Upvotes: 1
Reputation: 5299
This workaround may be helpful:
TAB T=1
SET urlCopy {{!URLCURRENT}}
TAB OPEN
TAB T=2
URL GOTO={{urlCopy}}
TAG POS=1 TYPE=DIV ATTR=ITEMPROP:name&&CLASS:product-card__description
TAG POS=1 TYPE=BUTTON ATTR=CLASS:"loading-spinner-btn button button--primary add-to-cart-button"
Old info.
You can open a link in a new tab simply by means of the following code:
TAB T=1
SET !EXTRACT http://somesite.com
TAB OPEN
TAB T=2
URL GOTO={{!EXTRACT}}
In your case, first of all play only this line:
TAG POS=1 TYPE=DIV ATTR=ITEMPROP:name&&CLASS:product-card__description EXTRACT=HTM
and see whether there is a link that you need, displayed in the popup window among other html-tags. If yes, provide this html-code to get a final solution.
Upvotes: 0