Extract anchor after an Image then click that specific anchor using IMACROS - extract

I am looking to extract an anchor after an image then click on that specific anchor I extracted.
I am trying to extract the anchor tag after "img src="http:mydomain.com/img/tags.png"
HTML:
<tr>
<td align="right">50.</td>
<td>
<img src="http:mydomain.com/img/tags.png">
<a href="/tag/dog/">
<strong>#dog</strong>
</a>
<span style="color:#999;">(</span>
<a title="" target="_blank" href="http://mydomain">+</a>
<span style="color:#999;">)</span>
</td>
<td style="vertical-align:middle;">
</tr>
IMACROS:
SET !TIMEOUT_PAGE 2
SET !ERRORIGNORE YES
URL GOTO=http://mydomain.com
TAG POS=1 TYPE=A ATTR=HREF:* EXTRACT=TXT
I am a complete noob at this, so I apologize on not knowing how to go about this...

if you want to extract "/tag/dog/" when you can use:
TAG POS=1 TYPE=A ATTR=HREF:* EXTRACT=href
if you want to click on scraped link, you could use :
TAG POS=1 TYPE=A ATTR=HREF:{{!extract}}

Related

Vue <a> tag href attribute splicing

My current url is http://localhost:8080/component, and in this page I have an <a> tag
<a :href="'/detail/' + comp._id"></a>
When comp._id is determined, for example it is 6221add333182348e1d70104.
I want the URL to jump to http://localhost:8080/component/detail/6221add333182348e1d70104 when I click on the link.
But actually it is http://localhost:8080/detail/6221add333182348e1d70104.
How can I achieve this ?
You can add /component/to your link. Like: <a :href="'/component/detail/' + comp._id"></a>

how to remove downloading option fom <a> tag

how to remove download option from a tag is it possible?
<a controls controlsList="nodownload" href="admin/upload/<?php echo $row['files']?>" class="venobox play-btn mb-4"data-vbtype="video" data-autoplay="true"></a>

How to Extract text, Without Extract All text?

How to copy text only TEST DRIVING 1?
Example Source HTML :
<div class="descr">
<div class="marg5px" style="outline: 1px solid blue;">
TEST DRIVING 1
<br>
Grab all the stars and avoid spikes as you grab keys and activate your shield.
<br>
</div>
</div>
My iMacros Code:
TAG POS=1 TYPE=DIV ATTR=CLASS:marg5px EXTRACT=TXT
SET !CLIPBOARD {{!EXTRACT}}
This code works, but the result shows unwanted text
The result I want is, just the words `TEST DRIVING 1' as in the following picture:
Please give me suggestion code to fix this problem.
Try this, sorry for late answer
TAG POS=1 TYPE=DIV ATTR=CLASS:MARG5px
TAG POS=1 TYPE=A ATTR=TITLE* EXTRACT=TXT

How to use ALT tag correctly?

I have used the ALT tags for all my images with this format:
<a alt="IMAGE ALT TEXT" href="http://2.bp.blogspot.com/-MEHRDQvoG-c/Ux0mL1mlJII/AAAAAAAAGg8/S9h3KjhJ6YQ/s1600/jquery-lightbox-with-dark-background.png" imageanchor="1"><img src="http://2.bp.blogspot.com/-MEHRDQvoG-c/Ux0mL1mlJII/AAAAAAAAGg8/S9h3KjhJ6YQ/s320/jquery-lightbox-with-dark-background.png" style="height:100%; width:100%;" /></a>
But I was surprised when the image checker tools sensed their alt tags as "missing". I supposed I had to insert the "alt" tag after the "img src" tag like that:
<img src="http://2.bp.blogspot.com/-MEHRDQvoG-c/Ux0mL1mlJII/AAAAAAAAGg8/S9h3KjhJ6YQ/s320/jquery-lightbox-with-dark-background.png" alt="IMAGE ALT TEXT" style="height:100%; width:100%;" />
Tell me please will this style correct?
alt is a property of IMG tag and not of A tag. It stands for alternative text to be shown or read by screen readers. So the second example you provided is the right one.
The alt attribute must be on the element and not on the hyperlink element.
You may be confusing the "alt" tag and the "title" tag.
The "alt" tag is used with images:
<img src="someImage.jpg" alt="image">
The title tag can be used with BOTH images and links
<img src="someImage.jpg alt="image" title="Some Image">
<a href="someLink.com" title="This is some link">
There wouldn't be any need for an "alt" tag on a traditional link, because even if the link was bad, there would still be text wrapped in the anchor indicating what it is:
Link to some link
With the image, the "alt" property value only displays when the image, for whatever reason, isn't available.
the alt should be only used in <applet>, <area>, <img>, <input>
alt - <applet>, <area>, <img>, <input> - Alternative text in case an
image can't be displayed.
Source
here is a snippet of img:
<img src="http://lorempixel.com/100/100" alt="image">

How to select button WITHIN some divs but NOT other divs?

The HTML I have to select from:
<div class="diviWANT">
<div class="adiv">
</div>
<button class="abutton" type="button">
<span class="aspan">
<i class="ani"></i>
SomeText
</span>
<span class="aclass2">
SomeText2
</span>
<span class="aclass3">
SomeText3
</span>
</button>
</div>
<div class="diviDONOTwant">
<div class="adiv">
</div>
<button class="abutton" type="button">
<span class="aspan">
<i class="ani"></i>
SomeText
</span>
<span class="aclass2">
SomeText2
</span>
<span class="aclass3">
SomeText3
</span>
</button>
</div>
Please note that the two divs are IDENTICAL except for the following:
<div class="diviWANT"> and <div class="diviDONOTwant">.
The following is my NONWORKING imacros script (NO BUTTON IS SELECTED AT ALL)
VERSION BUILD=6060703 RECORDER=FX
SET !TIMEOUT_STEP 1
SET !ERRORIGNORE YES
WAIT SECONDS=0.5
TAG POS=1 TYPE=DIV ATTR=CLASS:diviWANT&&TXT:SomeText
TAG POS=2 TYPE=DIV ATTR=CLASS:diviWANT&&TXT:SomeText
TAG POS=3 TYPE=DIV ATTR=CLASS:diviWANT&&TXT:SomeText
Ans here is my former NONWORKING imacros script (selects ALL BUTTONS EVEN THE ONES I DO NOT WANT)
VERSION BUILD=6060703 RECORDER=FX
SET !TIMEOUT_STEP 1
SET !ERRORIGNORE YES
WAIT SECONDS=0.5
TAG POS=1 TYPE=SPAN ATTR=CLASS:aspan&&TXT:SomeText
TAG POS=2 TYPE=SPAN ATTR=CLASS:aspan&&TXT:SomeText
TAG POS=3 TYPE=SPAN ATTR=CLASS:aspan&&TXT:SomeText
So how can I make it work?
Here is a jsbin for you to test to try to get it to work (updated to new one):
http://jsbin.com/AnewiNE/1/
If the button is clicked it turns purple. (this is for your reference so you know if it clicked the button or not.)
The only buttons that should be selected are the ones inside the divs with class diviWANT. These are random, there is no method or rhythm to the placement of diviWANT divs. i.e. you can't just select odd numbers, etc. You need to seek out and find only the buttons within diviWANT divs based only on the given html in this question.
var i=1;
do
{
iimSet("i", i);
iimPlay("CODE:TAG POS={{i}} TYPE=DIV ATTR=TXT:SomeText* EXTRACT=HTM");
if(iimGetLastExtract()!='#EANF#')
{
if(iimGetLastExtract().indexOf("diviWANT")>0)
{
iimSet("i", i);
iimPlay("CODE:TAG POS={{i}} TYPE=BUTTON ATTR=TXT:SomeText*");
}
}
else break;
i++;
}
while(i);
Tested on http://jsbin.com/oPuFiHa/4 and http://jsbin.com/AnewiNE/1 - it's working.
Note: replace indexOf("diviWANT") with indexOf("REAL_DIV_CLASS_NAME")
This is a JS code, save it in iMacros folder with extension *.js, not *.iim. Then refresh the iMacros list, more about JS read here.
P.S.: My final attempt to help you, based on details you provided, good luck.
To select something within something else try this example
TAG POS=1 TYPE=DIV ATTR=CLASS:JUST_AN_EXAMPLE&&TXT:SomeText
TAG POS=R1 TYPE=SPAN ATTR=CLASS:aOTHERspan&&TXT:SomeText
If this solves the problem let us know. Otherwise I will edit the answer. I can't tell from your code what div you want to select and what to leave.
Edited: The method is the same you just need to change it a little bit. So this will select a DIV and select SPAN in it. Since the DIV tag will be different then the other same SPAN in another DIV will not be selected.