Cannot Click on the button with Imacros - imacros

I cannot find a way to click on the button on Google Drive to click "File upload"
in Inspect element cannot find the exactly class which is changing every time,
trued to record with all kind of style but still not working.
Would be great if some one can check and figure out how it can be clicked.
Thank You in advance.
URL GOTO=https://drive.google.com/drive/my-drive
EVENT TYPE=MOUSEDOWN SELECTOR="#drive_main_page>DIV:nth-of-type(4)>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV>DIV>DIV" BUTTON=0
TAG POS=2 TYPE=DIV ATTR=CLASS:*-v&&ROLE:menuitem&&ID::4b
TAG POS=1 TYPE=INPUT:FILE ATTR=* CONTENT=C:\Users\Viktor\Documents\iMacros\Downloads\Folder\1.png

The following solution seems to work somehow:
' text for English as default language '
SET txtUpload "Upload files..."
URL GOTO=https://drive.google.com/drive/my-drive
EVENT TYPE=CLICK SELECTOR="#drive_main_page>DIV:nth-of-type(4)>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>svg>polygon" BUTTON=0
WAIT SECONDS=0.5
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=DIV ATTR=TXT:{{txtUpload}} EXTRACT=HTM
SET id EVAL("'{{!EXTRACT}}'.match(/id=\"(.+?)\"/)[1];")
EVENT TYPE=CLICK SELECTOR="#\\{{id}}>DIV>SPAN:nth-of-type(2)>SPAN>DIV" BUTTON=0
TAG POS=1 TYPE=INPUT:FILE ATTR=* CONTENT=C:\Users\Viktor\Documents\iMacros\Downloads\Folder\1.png

Related

imacros select from popup dropdown

Could you please help me :)
I have a TEXTBOX field which filling from a dropdown popup list.
enter image description here
It's not a drop-down list where I could use TYPE=SELECT
It doesn't take it as just a text, it needs to be picking from the list.
If I record a macro, it gives me:
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:management_main ATTR=ID:order_release/attribute1 CONTENT=201500
TAG POS=2 TYPE=TR ATTR=TXT:201500
If I record a macro in Experimental event recording mode:
EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>DIV>TABLE>TBODY>TR:nth-of-type(6)>TD:nth-of-type(3)>DIV>TABLE>TBODY>TR>TD>INPUT" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>DIV>TABLE>TBODY>TR:nth-of-type(6)>TD:nth-of-type(3)>DIV>TABLE>TBODY>TR>TD>INPUT" CHARS="201500"
EVENT TYPE=KEYPRESS SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>DIV>TABLE>TBODY>TR:nth-of-type(6)>TD:nth-of-type(3)>DIV>TABLE>TBODY>TR>TD>INPUT" KEY=13
EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(4)>DIV>DIV>TABLE>TBODY>TR>TD>DIV>DIV>TABLE>TBODY>TR>TD" BUTTON=0
I've tried:
EVENT TYPE=CLICK SELECTOR="#order_release/attribute1" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#order_release/attribute1" CHARS="201500"
it doesn't work also...
Inspection of elements:
enter image description here
So still can't catch this event to fill that field...
Have you any idea for me?
I would be veeeeeery thankful)
Thank you in advance!
I have found a solution and it works:
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:management_main ATTR=NAME:order_release/attribute1 CONTENT={{!COL7}}
TAG POS=1 TYPE=INPUT:HIDDEN FORM=NAME:management_main ATTR=ID:order_release/attribute1#ID CONTENT={{!COL7}}

iMacros EVENT mode is malfunctioning during KEYPRESS

I have an iMacros code that copies content from one blog and posts the article image and article body content to my Facebook Wall post. Here is the working code:
VERSION BUILD=844 RECORDER=CR
SET !EXTRACT_TEST_POPUP NO
SET URL http://www.marketwatch.com/story/too-early-to-tell-if-trump-bump-seen-in-jobs-numbers-economists-say-2017-03-10
URL GOTO={{URL}}
WAIT SECONDS=2
TAG POS=1 TYPE=IMG ATTR=CLASS:article-image<SP>MG EXTRACT=HREF
SET IMG {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS=1 TYPE=DIV ATTR=ID:article-body EXTRACT=TXT
SET BODY EVAL("var s=\"{{!EXTRACT}}\"; s=s.split('More from this Website')[0]; s;")
SET !EXTRACT NULL
URL GOTO=www.facebook.com
WAIT SECONDS=2
TAG POS=1 TYPE=DIV ATTR=CLASS:composerAudienceWrapper<SP>stat_elem<SP>_ej0
WAIT SECONDS=2
EVENTS TYPE=KEYPRESS SELECTOR="DIV[CLASS='_1mf _1mj']" CHARS="{{IMG}}"
WAIT SECONDS=5
EVENTS TYPE=KEYPRESS SELECTOR="DIV[CLASS='_1mf _1mj']" KEYS="[8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]"
WAIT SECONDS=2
EVENTS TYPE=KEYPRESS SELECTOR="DIV[CLASS='_1mf _1mj']" CHARS="{{BODY}}"
TAG POS=1 TYPE=BUTTON FORM=ID:u_0_15 ATTR=TXT:Post
WAIT SECONDS=2
At this line: EVENTS TYPE=KEYPRESS SELECTOR="DIV[CLASS='_1mf _1mj']" CHARS="{{IMG}}" , when the code pastes the image URL into Facebook, it does the work halfway and it starts to mis-function - meaning it starts clicking some randone buttons on my facebook wall (while this line of code is still executing)...
Is there a solution to this issue?
If you want to paste a large piece of text, try to do this via clipboard, for example:
SET !EXTRACT_TEST_POPUP NO
SET URL http://www.marketwatch.com/story/too-early-to-tell-if-trump-bump-seen-in-jobs-numbers-economists-say-2017-03-10
URL GOTO={{URL}}
WAIT SECONDS=2
TAG POS=1 TYPE=IMG ATTR=CLASS:article-image<SP>MG EXTRACT=HREF
SET IMG {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS=1 TYPE=DIV ATTR=ID:article-body EXTRACT=TXT
SET BODY EVAL("var s=\"{{!EXTRACT}}\"; s=s.split('More from this Website')[0]; s;")
SET !EXTRACT NULL
URL GOTO=www.facebook.com
WAIT SECONDS=2
SET !CLIPBOARD {{IMG}}
TAG POS=1 TYPE=LABEL ATTR=TXT:"Choose a file to upload"
TAG POS=R1 TYPE=DIV ATTR=ID:* EXTRACT=HTM
SET id EVAL("'{{!EXTRACT}}'.match(/id="(.*?)"/)[1];")
EVENT TYPE=CLICK SELECTOR="#{{id}}>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV" BUTTON=0
EVENT TYPE=KEYPRESS SELECTOR="#{{id}}>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV" CHAR="v" MODIFIERS="ctrl"
' ...

unable to paste content on yahoo body using iMacros

i have a piece of imacros code for sending out Yahoo eMails which works great. But except for pasting content in the body field. I have tried a few other methods using imacros, but i can't get this part to work.
Here is my code. Appreciate any help. :)
VERSION BUILD=844 RECORDER=CR
SET EMAIL "test#test.com"
SET PASS "password"
SET !ERRORIGNORE YES
URL GOTO=https://login.yahoo.com/?.src=ym&.intl=us&.lang=en-US&.done=https%3a//mail.yahoo.com
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:mbr-login-form ATTR=ID:login-username CONTENT={{EMAIL}}
TAG POS=1 TYPE=BUTTON FORM=ID:mbr-login-form ATTR=ID:login-signin
SET !ENCRYPTION NO
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:mbr-login-form ATTR=ID:login-passwd CONTENT={{PASS}}
TAG POS=1 TYPE=BUTTON FORM=ID:mbr-login-form ATTR=ID:login-signin
WAIT SECONDS=3
TAG POS=1 TYPE=SPAN ATTR=ID:yui_3_16_0_ym19_1_*
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:to-field CONTENT=test#gmail.com
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:subject-field CONTENT=test
TAG POS=1 TYPE=DIV ATTR=ID:rtetext
TAG POS=5 TYPE=SPAN ATTR=ID:yui_3_16_0_ym19_1_*
Have you tried using the Event recording mode (iMacros Sidebar - Manage Tab - Settings) for entering the message body? I tried a quick recording myself and found that the following two commands together were successful in filling the message body:
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(9)>DIV:nth-of-type(3)>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV:nth-of-type(7)>DIV>TABLE>TBODY>TR:nth-of-type(2)>TD>DIV>DIV>DIV:nth-of-type(2)" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>DIV:nth-of-type(9)>DIV:nth-of-type(3)>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV:nth-of-type(7)>DIV>TABLE>TBODY>TR:nth-of-type(2)>TD>DIV>DIV>DIV:nth-of-type(2)" CHARS="this is a test"

how to write .iim file for imacros

VERSION BUILD=6060703 RECORDER=CR
URL GOTO=URL
TAG POS=1 TYPE=INPUT:BUTTON ATTR=*
WAIT SECONDS=6
This is the code I'm using for .iim file to click on a button on a website. But I couldn't understand what this code is and what are those tag pos and button attr. When I run this code there's an error like this.
RuntimeError: element INPUT specified by * was not found, line: 3
What is this error and how to tackle it. Please help.
TAG POS=1 TYPE=INPUT:BUTTON ATTR=*
This is a button that submits something. Find that button on web page. Right click on it and select "Inspect Element". Then you will see HTML code of that button.
If it has property name="somename" or id="someid" then you will put
TAG POS=1 TYPE=INPUT:BUTTON ATTR=NAME:somename
TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:someid

iMacros ondialog conditional statement

I'm trying to make iMacros send me an email, if after login I get a dialog. In this
case its a warning that I should update my password before it expires.
I would like some output to php that I can use to send the email. I'm presently able to get getLastExtract but nothing in the returned array mentions the dialog in any way.
This is the script so far:
CODE: SET !REPLAYSPEED FAST
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=[URL]
SET !EXTRACTDIALOG YES
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminLogin ATTR=ID:username CONTENT=[username]
SET !ENCRYPTION NO
ONDIALOG POS=1 BUTTON=NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:adminLogin ATTR=ID:password CONTENT=[password]
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:adminLogin ATTR=VALUE:Login