imacros to javascript

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
webview_macro
Posts: 4
Joined: Tue May 26, 2020 7:54 pm

imacros to javascript

Post by webview_macro » Tue May 26, 2020 8:43 pm

X64 bit windows 10
X64 bit chrome
imacros for chrome (latest version)
imacros exe to try js export (latest version, personal use free trial)

Hi this is my first time here.

I recorded on imacros a click on an html button with an ID called id_1 how
can I convert the imacros generated instruction click
into a javascript dispatch like:

document.getElementById("id_1").click()

Reason I want the generated instrctions ported to js is to be able to use the lines on my
webview applications.. like timer based script injection events, listening for webpage loads etc.

I will gladly donate to your PayPal for a good clear answer based on how well your
example response is for a first time user. Just leave your PayPal email.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: imacros to javascript

Post by chivracq » Tue May 26, 2020 9:32 pm

webview_macro wrote:
Tue May 26, 2020 8:43 pm

Code: Select all

X64 bit windows 10
X64 bit chrome
imacros for chrome (latest version)
imacros exe to try js export (latest version, personal use free trial)
Hi this is my first time here.

I recorded on imacros a click on an html button with an ID called id_1 how
can I convert the imacros generated instruction click
into a javascript dispatch like:

Code: Select all

document.getElementById("id_1").click()
Reason I want the generated instrctions ported to js is to be able to use the lines on my
webview applications.. like timer based script injection events, listening for webpage loads etc.

I will gladly donate to your PayPal for a good clear answer based on how well your
example response is for a first time user. Just leave your PayPal email.

Hum..., this one Approved as the Quality is a bit better than your 1st Attempt, but hum...!:
=> FCIM...! :mrgreen: (Read my Sig...)
"latest" doesn't mean anything on a Tech Forum, simply mention the exact Versions... :roll:

+ I don't understand what you mean with "imacros exe to try js export (latest version, personal use free trial)"... :?
'imacros.exe' will be iMB I guess...? (=> iMacros Browser), => iMB v12.6 'Trial', I reckon...?
But I don't know of any "js export" whatever...? :?
+ 'Free'/'PE' is also missing about iMacros for CR, probably v10.0.5, unless "personal use free trial" also applied to CR..., but pfff..., your FCI is not clear...!

And you use "instruction"/"instructions" (Singular/Plural) (with Typos as a Bonus...! :roll: ), so it's not clear if you want to convert just one Recorded Statement by iMacros into your 'WebView' Syntax (should be fairly easy, I would think...), or if you want to create some kind of (automated) 'WebView' Script Generator from/with iMacros...? (Interesting Idea actually... :twisted: )

So hum, for a "good clear answer", maybe you should start with a "good clear Question/Scenario"...! :idea:

And post some concrete Example(s) with URL and Script recorded by iMacros, and what exact Output you want for your 'WebView' Script, if you know it, or post some Link/Reference to some 'WebView' Documentation/Site..., not "our" Role to go searching for this Tool/Software or whatever it is...
(+ Mention also your FCI on the 'WebView' "Target"-Side...)

+ Same Quality expected also if you opened some parallel Thread(s) on some 'WebView' Tech Forum or any other Tech Forum(s), and post the direct Link(s) to any parallel Thread(s)... :!:
Last edited by chivracq on Wed May 27, 2020 12:35 am, edited 1 time in total.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
webview_macro
Posts: 4
Joined: Tue May 26, 2020 7:54 pm

Re: imacros to javascript

Post by webview_macro » Wed May 27, 2020 12:08 am

imacros chrome store extension version 2.410


imacros settings set too:

event recording mode (gets tab presses etc.. more detailed)
Use element ids whenever possible
Use CSS selectors
replay speed: medium

afterwards I went to paypal to send money as a friend to be an automated task, here is what I recorded, sometimes rather than button presses I used tab + enter keys to get a button press.

here is the full working recording:

Code: Select all

VERSION BUILD=1005 RECORDER=CR
URL GOTO=https://www.paypal.com/myaccount/transfer/homepage
EVENT TYPE=MOUSEDOWN SELECTOR="#react-transfer-container>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>FORM>DIV>DIV>DIV>DIV>DIV>DIV>DIV>LABEL" BUTTON=0
EVENT TYPE=MOUSEMOVE SELECTOR="#react-transfer-container>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>FORM>DIV>DIV>DIV>DIV>DIV>DIV>DIV>LABEL" POINT="(297,242)"
EVENT TYPE=MOUSEUP POINT="(297,242)"
EVENT TYPE=CLICK SELECTOR="#react-transfer-container>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>FORM>DIV>DIV>DIV>DIV>DIV>DIV>DIV>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="#fn-sendRecipient" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#fn-sendRecipient" CHARS="g6browser@gmail.com"
EVENT TYPE=KEYPRESS SELECTOR="#fn-sendRecipient" KEY=13

EVENT TYPE=MOUSEUP POINT="(405,228)"
EVENT TYPE=CLICK SELECTOR="#fn-amount" BUTTON=0
EVENT TYPE=KEYPRESS SELECTOR="#fn-amount" CHAR="1"

EVENT TYPE=MOUSEDOWN SELECTOR="#recipientName" BUTTON=0
EVENTS TYPE=MOUSEMOVE SELECTOR="#recipientName" POINTS="(417,525),(417,525)"
EVENT TYPE=MOUSEUP POINT="(417,525)"
EVENT TYPE=CLICK SELECTOR="#recipientName" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#recipientName" CHARS="hi"
EVENT TYPE=KEYDOWN SELECTOR="#recipientName" KEY=13
EVENT TYPE=KEYPRESS SELECTOR="#recipientName" CHAR="\r"
EVENT TYPE=CLICK SELECTOR="#react-transfer-container>DIV>DIV>FORM>BUTTON" BUTTON=0
EVENT TYPE=KEYUP SELECTOR="#recipientName" KEY=13

EVENT TYPE=KEYUP SELECTOR="#personal" KEY=9
EVENT TYPE=KEYDOWN SELECTOR="#personal" KEY=13
EVENT TYPE=KEYPRESS SELECTOR="#personal" CHAR="\r"
EVENT TYPE=CLICK SELECTOR="#personal" BUTTON=0
EVENT TYPE=KEYUP SELECTOR="#personal" KEY=13
so what happened in the script above was, I load the paypal url page to send money, I use mouse down event on input field to enter recipients email, key press event types "g6browser@gmail.com" in the fn-recipient input field, keypress 13 event I clicked enter key to continue to next area of site where i click the input field fn-amount and than type 1 to send 1 cent, i click the lower recipient name input field and keypress event to type "hi" as the name, key press event 13 which is enter button to continue, key press 9 which is tab button to select a button and than keypress 13 which is enter to continue, and thats as far as I wanted to take it, replayed it and it worked, but I need to port this into javascript to run it in my scripted webview browser.


now I want to use f12 developer tools on chrome > console > enter the commands one by one too happen through the console, maybe imacros has a javascript file to include before running commands like that?

I found this url to convert imacros to javascript: https://repo.advena.me/imacros-converter/

but when I call the last generated function by advena its unknown maybe im missing a library like I said, it seems like advena puts all the commands into a javascript array and I have to include a imacros javascript library to run each function as a queue of scripts to inject.


version 12.6.0.190 of Imacros Editor.exe > export > scripting interface > export as js

to port it as a static unchanging script by hand would not be a good idea if the site were to get a new set of variables/updates, if I however do a re-reocording and we have an auto-port to javascript it would be a faster solution.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: imacros to javascript

Post by chivracq » Wed May 27, 2020 1:57 am

webview_macro wrote:
Wed May 27, 2020 12:08 am
imacros chrome store extension version 2.410

imacros settings set too:

Code: Select all

event recording mode (gets tab presses etc.. more detailed)
Use element ids whenever possible
 Use CSS selectors
replay speed: medium
afterwards I went to paypal to send money as a friend to be an automated task, here is what I recorded, sometimes rather than button presses I used tab + enter keys to get a button press.

here is the full working recording:

Code: Select all

VERSION BUILD=1005 RECORDER=CR
URL GOTO=https://www.paypal.com/myaccount/transfer/homepage
EVENT TYPE=MOUSEDOWN SELECTOR="#react-transfer-container>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>FORM>DIV>DIV>DIV>DIV>DIV>DIV>DIV>LABEL" BUTTON=0
EVENT TYPE=MOUSEMOVE SELECTOR="#react-transfer-container>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>FORM>DIV>DIV>DIV>DIV>DIV>DIV>DIV>LABEL" POINT="(297,242)"
EVENT TYPE=MOUSEUP POINT="(297,242)"
EVENT TYPE=CLICK SELECTOR="#react-transfer-container>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>FORM>DIV>DIV>DIV>DIV>DIV>DIV>DIV>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="#fn-sendRecipient" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#fn-sendRecipient" CHARS="g6browser@gmail.com"
EVENT TYPE=KEYPRESS SELECTOR="#fn-sendRecipient" KEY=13

EVENT TYPE=MOUSEUP POINT="(405,228)"
EVENT TYPE=CLICK SELECTOR="#fn-amount" BUTTON=0
EVENT TYPE=KEYPRESS SELECTOR="#fn-amount" CHAR="1"

EVENT TYPE=MOUSEDOWN SELECTOR="#recipientName" BUTTON=0
EVENTS TYPE=MOUSEMOVE SELECTOR="#recipientName" POINTS="(417,525),(417,525)"
EVENT TYPE=MOUSEUP POINT="(417,525)"
EVENT TYPE=CLICK SELECTOR="#recipientName" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#recipientName" CHARS="hi"
EVENT TYPE=KEYDOWN SELECTOR="#recipientName" KEY=13
EVENT TYPE=KEYPRESS SELECTOR="#recipientName" CHAR="\r"
EVENT TYPE=CLICK SELECTOR="#react-transfer-container>DIV>DIV>FORM>BUTTON" BUTTON=0
EVENT TYPE=KEYUP SELECTOR="#recipientName" KEY=13

EVENT TYPE=KEYUP SELECTOR="#personal" KEY=9
EVENT TYPE=KEYDOWN SELECTOR="#personal" KEY=13
EVENT TYPE=KEYPRESS SELECTOR="#personal" CHAR="\r"
EVENT TYPE=CLICK SELECTOR="#personal" BUTTON=0
EVENT TYPE=KEYUP SELECTOR="#personal" KEY=13
so what happened in the script above was, I load the paypal url page to send money, I use mouse down event on input field to enter recipients email, key press event types "g6browser@gmail.com" in the fn-recipient input field, keypress 13 event I clicked enter key to continue to next area of site where i click the input field fn-amount and than type 1 to send 1 cent, i click the lower recipient name input field and keypress event to type "hi" as the name, key press event 13 which is enter button to continue, key press 9 which is tab button to select a button and than keypress 13 which is enter to continue, and thats as far as I wanted to take it, replayed it and it worked, but I need to port this into javascript to run it in my scripted webview browser.


now I want to use f12 developer tools on chrome > console > enter the commands one by one too happen through the console, maybe imacros has a javascript file to include before running commands like that?

I found this url to convert imacros to javascript: https://repo.advena.me/imacros-converter/

but when I call the last generated function by advena its unknown maybe im missing a library like I said, it seems like advena puts all the commands into a javascript array and I have to include a imacros javascript library to run each function as a queue of scripts to inject.


version 12.6.0.190 of Imacros Editor.exe > export > scripting interface > export as js

to port it as a static unchanging script by hand would not be a good idea if the site were to get a new set of variables/updates, if I however do a re-reocording and we have an auto-port to javascript it would be a faster solution.

Alright, good-good, the Quality of your Thread is improving quite a lot...! :D

But hum, OK, let's start with a big Laugh, ah-ah-ah...!, Thanks for that..., your "v2.410" as the Version for iMacros for CR that you mention/think you are using, is euh..., hum..., maybe you want to check again what it is...!? :idea: :oops: :shock: :twisted: :P
... And I'm pretty sure you will laugh with me, ah-ah...! :wink:

But OK, thanks to the Link you provided to the CR Extension Store to iMacros for CR, so you are using:

Code: Select all

iMacros for CR v10.0.5, 'Free'/'PE'...?, CR v...?_x64, Win10_x64.
And v10.0.5 for CR is also confirmed by the "VERSION BUILD=1005 RECORDER=CR" from your Script...

Oh, then sorry, grrr...!, I stop here... :roll: , I was going to post a much longer Reply, but we are still missing your CR Version, probably CR81...?, I reckon...?
Sorry, but I don't answer Threads until FCI has been mentioned... :|
"X64 bit chrome" is not good enough for me...
And 'Free'/'PE' is still missing also, but I reckon you are using the 'Free' Version...?

+ And update your OP (Opening Post) to mention your FCI (full and complete) at the very top of your OP so that I can find it back easily "later" without having to re-read the whole Thread to find mini-bits in several Posts... :!:

>>>

And you can in the "meantime" also already have a look at the following Thread, (Advanced) User @Tanckom from our Forum from a few years ago is the "Lars" who wrote your "Advena" JS Converter...:
- [FREE] iMacros to Java Script Converter
You will maybe/hopefully already understand "a few things" by yourself without me needing to explain... :idea:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
webview_macro
Posts: 4
Joined: Tue May 26, 2020 7:54 pm

Re: imacros to javascript

Post by webview_macro » Wed May 27, 2020 2:04 am

chrome version: Version 83.0.4103.61 (Official Build) (64-bit)

I have a better idea if you cant help the above question:
I want imacros to check every 10 seconds testurl.php and store the echo'd data in a variable that I can use to goto another url, click an input field and enter the variable, is it possible? than when it loops, back to testurl.php to check if the echo'd data is nothing new, keep checking testurl.php until something new, before going to the url for input field.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: imacros to javascript

Post by chivracq » Sun May 31, 2020 5:15 pm

webview_macro wrote:
Wed May 27, 2020 2:04 am

Code: Select all

chrome version: Version 83.0.4103.61 (Official Build) (64-bit)
I have a better idea if you cant help the above question:
I want imacros to check every 10 seconds testurl.php and store the echo'd data in a variable that I can use to goto another url, click an input field and enter the variable, is it possible? than when it loops, back to testurl.php to check if the echo'd data is nothing new, keep checking testurl.php until something new, before going to the url for input field.

OK, 4 days later, I had "nearly" forgotten about you, we still don't have your FCI, 'Free'/'PE' is still missing, and I had asked you to mention all bits of Info in your OP, but to no avail apparently..., then OK, fair enough...! :|

Then, hum..., you sound a bit "ADHD" with a "pretty messy Mind", ah-ah...!, can sometimes be an "Advantage" with iMacros, but hum, I have my "Doubts" that will "really" work out in this Case... :|

Then OK, your Scenario was interesting, I thought, but I don't feel going into the if-if-if as we still don't have your complete FCI, some Functionality that you've mentioned would only work/be possible with the 'PE' Version anyway, while I guess you are probably using the 'Free' Version..., but..., pfff..., "it" all sounds pretty cumbersome to me..., if you want to automate 'PayPal' Payments (sounds "dangerous" to me btw...! :shock: ), but if you already have a Script that works with iMacros, then simply use that Script, I would think... 8)

I don't understand why you want to convert a Script that works to some other Tool that is apparently "less Advanced that iMacros" and cannot provide a Recorder like iMacros does..., and where a recorder Script works directly... :P

Alright, "good luck" further then, and maybe post an Update one day, to explain how you finally implemented that Functionality/Scenario of yours... :idea:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
webview_macro
Posts: 4
Joined: Tue May 26, 2020 7:54 pm

Re: imacros to javascript

Post by webview_macro » Mon Jun 01, 2020 7:35 am

Actually. In the extension directory for imacros, I found the imacros command interpreter that does the mousepoint and keyboard dispatches. I may be able to port the whole thing to my webview or just do the proper dispatch procedures, if it works I'll be sure to purchase personal use version of imacros, I might just be fine, I'm advanced, I see the javascript recorder, actually I worked on a chromium extension for Debian and released an 18 second boot copy, compared to the original 52 second boots
Post Reply