Clicking element of a DIV + IF

Discussions and Tech Support related to the iMacros Google Chrome extension.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Exudius
Posts: 1
Joined: Sat May 14, 2016 6:37 am

Clicking element of a DIV + IF

Post by Exudius » Sat May 14, 2016 7:00 am

This is the div when the like_icon is not yet pressed

I want to make the script press the like_icon only when its in this state (Not currently clicked):

Code: Select all

<div class="stats_wrapper">
    <span class=" like_icon"></span>
    <span class="like_count">2</span>
</div>
After i press : like_icon

Code: Select all

<div class="stats_wrapper has liked">
    <span class=" like_icon"></span>
    <span class="like_count">3</span>
</div>
The div changes name after I click the like icon. >> stats_wrapper has liked

My question is : How do I make the script click only the like_icons which hasn't been clicked yet by looking at the div title ?

Current (shitty)code:

Code: Select all

iimPlay("CODE:TAB T=1\nURL GOTO=funnysite TAG POS=1 TYPE=SPAN ATTR=CLASS:stats_wrapper EXTRACT=TXT");
var G_Extract= iimGetLastExtract(1);
if (G_Extract=="stats_wrapper")
{
var G_Extract="CODE:";
G_Extract=G_Extract+"TAG POS=1 TYPE=SPAN ATTR=CLASS:like_icon");
iimPlay(G_Extract)
}
else if(G_Extract!="stats_wrapper")
{
iimPlay("CODE:URL GOTO=funnysite")
}
OS: Windows 8
V-iMacros : 10022823
Browser : Chrome
Last edited by Exudius on Sat May 14, 2016 7:16 am, edited 1 time in total.
chivracq
Posts: 8921
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Clicking element of a DIV + IF

Post by chivracq » Sat May 14, 2016 7:07 am

Exudius wrote:This is the div when the like_icon is not yet pressed

I want to make the script press the like_icon only when its in this state (Not currently clicked):

Code: Select all

<div class="stats_wrapper">
    <span class=" like_icon"></span>
    <span class="like_count">2</span>
</div>
After i press : like_icon

Code: Select all

<div class="stats_wrapper has liked">
    <span class=" like_icon"></span>
    <span class="like_count">3</span>
</div>
The div changes name after I click the like icon. >> stats_wrapper has liked

My question is : How do I make the script click only the like_icons which hasn't been clicked yet by looking at the div title ?

Current (shitty)code:

Code: Select all

iimPlay("CODE:TAB T=1\nURL GOTO=funnysite TAG POS=1 TYPE=SPAN ATTR=CLASS:stats_wrapper EXTRACT=TXT");
var G_Extract= iimGetLastExtract(1);
if (G_Extract=="stats_wrapper")
{
var G_Extract="CODE:";
G_Extract=G_Extract+"TAG POS=1 TYPE=SPAN ATTR=CLASS:like_icon");
iimPlay(G_Extract)
}
else if(G_Extract!="stats_wrapper")
{
iimPlay("CODE:URL GOTO=funnysite")
}
Yep, probably interesting but CIM...! :mrgreen: => I don't read, read my Sig...

Wondering how you can use 'iimPlay()' while you are posting in the CR Sub-Forum...!? :roll:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply