Imacros won't click button? - imacros

I'm trying to build a script to post auto blog on Google Sites but the problem is that the button won't click. This is my screenshot: http://i.stack.imgur.com/W5mxq.png
Code Button
<div aria-label="New page" tabindex="0" style="-moz-user-select: none;" role="button" id="create-new-btn" class="goog-inline-block jfk-button jfk-button-standard jfk-button-collapse-left" aria-disabled="false"><span id="sites-collaborator-bar-create-new-page-icon" class="sites-camelot-icon"></span></div>
This is my code in Imacros
Code IMACROS
VERSION BUILD=7601105 RECORDER=FX
TAB T=1
URL GOTO=https://sites.google.com/site/testing/
TAG POS=1 TYPE=DIV ATTR=ID:create-new-btn
This is other code but in Javascript Imacros
Code JAVA
var macro;
macro = "CODE:";
macro += "TAB T=1" + "\n";
macro += "SET !ERRORIGNORE YES" + "\n";
macro += "SET !ERRORCONTINUE YES" + "\n";
macro += "SET !EXTRACT_TEST_POPUP NO" + "\n";
macro += "SET !TIMEOUT 500" + "\n";
macro += "URL GOTO=https://sites.google.com/site/testing/" + "\n";
macro += "TAG POS=1 TYPE=DIV ATTR=ID:create-new-btn" + "\n";
iimPlay(macro)

you can simply load create new page form instead of clicking on the button, since to click you'll have to emulate mouse hovering and use javascript.
Just load: https://sites.google.com/site/your-site/system/app/pages/createPage?source=/home

A possible work around is to use the CLICK command in imacros like so:
VERSION BUILD=7601105 RECORDER=FX
TAB T=1
URL GOTO=https://sites.google.com/site/testing/
CLICK X=1000 Y=10
where X is the distance from the top-left side of the browser to the middle of the button you want to click, and Y is the distance from the top of the browser to the middle of the button you want to click. You are able to measure these distances by doing a print-screen and going into a tool like paint and measuring the pixel distances (or any other tool you find more convenient).

You can try imacros for Firefox instead of Chrome, because in terms of clicking buttons imacros somehow perform better in Mozilla Firefox browser.

Maybe you should try clicking on the span inside that div. Perhaps this trigger the action.
VERSION BUILD=7601105 RECORDER=FX
TAB T=1
URL GOTO=https://sites.google.com/site/testing/
TAG POS=1 TYPE=SPAN ATTR=ID:sites-collaborator-bar-create-new-page-icon

Related

Auto Click a button until a specific text appear in page using iMacros

I'm trying to make an auto-click to a button on a website and do nothing when a specific text appears on the page
Using iMacros, how can I use if a specific text element had the value I wanted so it won't skip?
HTML:
<span class="tr-country" data-tr="IQ">Iraq</span>
<i class="flag message-flag flags-IQ"></i>
iMacros Recorder:
VERSION BUILD=1011 RECORDER=CR
URL GOTO=https://ometv.chat/
FRAME F=1
TAG POS=2 TYPE=DIV ATTR=TXT:next
TAG POS=2 TYPE=SPAN ATTR=TXT:South<SP>Africa (Some Random Country)
TAG POS=1 TYPE=I ATTR=CLASS:flag<SP>message-flag<SP>flags-ZA
What I want is to check if the class "tr-country" has the data-tr of "IQ" then we don't click/tag "next" button
How can I do that condition in iMacros?
Thanks in advance..
FCI:
iMacros for Chrome 10.1.1 Free
Windows 10 English
Version 96.0.4664.93 (Official Build) (64-bit)

iMacro issue posting to minds. com

The new social media site minds.com does not seem to have an API for posting, so I have tried to create a macro to do so from a single line text file, thus (iMacros for Firefox [50.1]). I have tried the x-y method and the conventional methods as well as the "experimental" mode, shown following:
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
'SET !ERRORIGNORE YES
SET !DATASOURCE C:\[path-to-file]\[single line of text here].txt
SET !DATASOURCE_COLUMNS 1
SET !LOOP 1
'SET !DATASOURCE_LINE {{!LOOP}}
'SET !DATASOURCE_LINE {{1}}
URL GOTO=https://www.minds.com/newsfeed
EVENT TYPE=CLICK SELECTOR="HTML>BODY>MINDS-APP>MINDS-BODY>MINDS- NEWSFEED>DIV>DIV>MINDS-NEWSFEED-POSTER>DIV>DIV>FORM>TEXTAREA" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>MINDS-APP>MINDS-BODY>MINDS- NEWSFEED>DIV>DIV>MINDS-NEWSFEED-POSTER>DIV>DIV>FORM>TEXTAREA" CONTENT=Hi!
EVENT TYPE=CLICK SELECTOR="HTML>BODY>MINDS-APP>MINDS-BODY>MINDS- NEWSFEED>DIV>DIV>MINDS-NEWSFEED-POSTER>DIV>DIV>FORM>DIV>BUTTON" BUTTON=0
and I tried:
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
URL GOTO=https://www.minds.com/newsfeed
SET !TIMEOUT_PAGE 30
TAG POS=1 TYPE=TEXTAREA FORM=NAME:NoFormName ATTR=ID:message CONTENT=Hello!
TAG POS=1 TYPE=BUTTON FORM=NAME:NoFormName ATTR=ID:Post<SP>send
Neither seems to work, nor does an x-y click (which just highlights the 'Post' button but does not "click" it).
The salient HTML for the button is:
<button class="mdl-button mdl-button--colored" type="submit">
Post <i class="material-icons">send</i>
</button>
I'm not sure what I'm missing. Any suggestions would be greatly appreciated.
Thanks!
-Brian Brown, Ph.D.
This part of your macro must work fine:
EVENT TYPE=CLICK SELECTOR="HTML>BODY>MINDS-APP>MINDS-BODY>MINDS-NEWSFEED>DIV>DIV>MINDS-NEWSFEED-POSTER>DIV>DIV>FORM>TEXTAREA" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>MINDS-APP>MINDS-BODY>MINDS-NEWSFEED>DIV>DIV>MINDS-NEWSFEED-POSTER>DIV>DIV>FORM>TEXTAREA" CHARS="Hi !"
EVENT TYPE=CLICK SELECTOR="HTML>BODY>MINDS-APP>MINDS-BODY>MINDS-NEWSFEED>DIV>DIV>MINDS-NEWSFEED-POSTER>DIV>DIV>FORM>DIV>BUTTON" BUTTON=0
Doesn't it?

iMacro text field Inputting issue

hopefully you can help me. This is my attempt at using a macro to add text into a text field on a website.​
This is my current iMacro code, which opens the text box (by clicking a couple of buttons) however doesn't activate the text box nor add any text into it:
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
URL GOTO=https://datatron.l2inc.com/#resources?selected=brandTab5229&brands=5229
TAG POS=1 TYPE=BUTTON ATTR=TXT:Create<SP>New<SP>Resources<SP>for<SP>Brand
TAG POS=1 TYPE=BUTTON ATTR=ID:add-urls
PROMPT "Please enter something:" !VAR1
TAG POS=1 TYPE=TEXTAREA ATTR=CLASS:form-control CONTENT={{!VAR1}}
The last lines are my attempt adding my own text (VAR1) into the textbox. The relevant html code (created by javascript) simply reads as this:
​<textarea class="form-control urls-textarea" rows="10" placeholder="irrelevant placeholder text"></textarea>
Do you know where I am going wrong??
Best regards
Roman
Try to record your manual typing wlth 'Experimental event recording mode'.
Taking into account the html code you provided, the event command may look like:
EVENTS TYPE=KEYPRESS SELECTOR="textarea[class='form-control urls-textarea']" CHARS={{!VAR1}}

iMacro dynamic attribute data extract

I have been trying to resolve this issue through different angles but not having any luck. Even tried using PHP to generate iMacro code to do this but really no luck.
Basically I am trying to use iMacro to pull some form data but the problem is on every page of the form I have 100 links to click but the issue is that I don't know how to tell iMacro to keep clicking the links in the table without specifying each link's name in the attribute:
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>China
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>Mexico
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>Japan
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>Brazil
See how the ATTR=TXT field indicates the text of the element in the table? This means to get iMacro to click all the links I have to specify every element's text....This is a pain..Is there a way I can get iMacro to click on the links without specifying the text?
UPDATE: Here is the updated code that highlights but won't click the first link.
FRAME NAME=TargetContent
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=TXT:*
'New tab opened
TAB T=2
TAG POS={{!LOOP}} TYPE=DIV ATTR=ID:win2divUW_CO_JOBDTL_VW_UW_CO_JOB_DESCR EXTRACT=TXT
TAB CLOSE
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Documents\iMacro FILE=TestRun.csv
Here is what the HTML of the first link in table looks like, it is all generated by the server:
<a name="UW_CO_sd_HL$0" id="UW_CO_sd_HL$0" tabindex="72" href="javascript:hAction_win0(document.win0,'UW_CO_sd_HL$0', 0, 0, 'Trip To Tokyo', false, true);" class="PSHYPERLINK">Tokyo</a>
The second HTML link in table looks like:
<a name="UW_CO_sd_HL$1" id="UW_CO_sd_HL$0" tabindex="78" href="javascript:hAction_win0(document.win0,'UW_CO_sd_HL$1', 0, 0, 'Tonka Side', false, true);" class="PSHYPERLINK">Tonka</a>
UPDATE 2:
Here is the iMacro code after I do experimental recording and then x/y co-ordinate click. The code is from clicking the first couple of elements.
CLICK X=131 Y=473
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=153 Y=500
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=194 Y=541
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=152 Y=572
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=149 Y=608
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=169 Y=629
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=173 Y=666
TAB T=2
TAB CLOSE
TAB T=1
This code can be transformed to work better.
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>*
For example if the links HTML looks like this
Trip to Somewhere
Then you can use these combinations of iMacros code to click the links.
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=CLASS:link&&TXT:*
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=ID:linkid&&TXT:*
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=HREF:www.somelink.com/soomething_different_here/*&&TXT:*
Each of these combinations can work.

Refresh the page if a word found imacros

i want imacros to go to a specific page
and search for a word then refresh the page and loop search if word is found else move to next step
For this you can use javascript scripting. No one will make you a script like this but here is an example.
var macro;
macro ="CODE:";
macro +="TAG POS=1 TYPE=DIV ATTR=TXT:sometext";
if(iimPlay(macro)>0)
{
//text is there
//do something
}
else
{
//text is not there
}