Workaround for 'EVENT' 'MOUSEMOVE' hanging on non-present Element/Selector.

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
kkipling5
Posts: 14
Joined: Sat Aug 03, 2019 7:29 am

Re: Workaround for 'EVENT' 'MOUSEMOVE' hanging on non-present Element/Selector.

Post by kkipling5 » Tue Aug 20, 2019 2:22 pm

I tried different versions of PaleMoon but the results were same as that in Firefox.

So, considering the flow you've mentioned, algorithm should look something like this:

0. Open google.com on TAB T=2
1. On TAB T=1, look for a specific element
2. If the element exists, execute the MOUSEMOVE command
3. Else, switch to TAB T=2 and execute the MOUSEMOVE command.
4. TAB T=1 on the proceeding loop

Can you please help me with the code to look for an element and switch to another tab? Also, you've mentioned that EVAL does not works properly on error pages. If EVAL were used for conditionals wouldn't that create another problem?
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Workaround for 'EVENT' 'MOUSEMOVE' hanging on non-present Element/Selector.

Post by chivracq » Tue Aug 20, 2019 8:32 pm

kkipling5 wrote:
Tue Aug 20, 2019 2:22 pm
I tried different versions of PaleMoon but the results were same as that in Firefox.

So, considering the flow you've mentioned, algorithm should look something like this:

0. Open google.com on TAB T=2
1. On TAB T=1, look for a specific element
2. If the element exists, execute the MOUSEMOVE command
3. Else, switch to TAB T=2 and execute the MOUSEMOVE command.
4. TAB T=1 on the proceeding loop

Can you please help me with the code to look for an element and switch to another tab? Also, you've mentioned that EVAL does not works properly on error pages. If EVAL were used for conditionals wouldn't that create another problem?

Hum, OK, I'm a bit surprised about Pale Moon, maybe its Core Code changed a bit from PM26 that I use myself to PM27 and/or PM28, I don't know, I never installed/tried those Versions, and you don't mention which PM Versions you tried, but I wouldn't advise PM26 anyway...

Then, OK, back to the "TAB_2" Workaround I mentioned then... But pfff, the Principle is easy, and is actually exactly the same like for the 'MOUSEMOVE' and switching between the "real" Selector and the "fake" 'BODY', it's fairly simple, there is nothing "difficult", I would think... :o

And what I mentioned about "the ugly Blocking Bug with 'EVAL()' only applies to v10.0.2 for FF (+FF60+). You are using v8.9.7 for FF, so you are not concerned...

But OK, here it goes...! If I start from your "original" Code:

Code: Select all

SET !EXTRACT NULL
TAG POS=1 TYPE=CANVAS ATTR=ID:js-canvas EXTRACT=TXT
SET Object_is_there EVAL("var s='{{!EXTRACT}}'; var x; if(s!='#EANF#'){x='#js-canvas';} else{x='BODY';}; x;")

EVENT TYPE=CLICK SELECTOR="#js-canvas" BUTTON=0
EVENT TYPE=MOUSEDOWN SELECTOR="#js-canvas" BUTTON=0
EVENTS TYPE=MOUSEMOVE SELECTOR="{{Object_is_there}}" POINTS="(303,275),(309,310),[...(truncated)...],(376,467),(374,476)"
EVENT TYPE=MOUSEUP POINT="(373,453)"

WAIT SECONDS = 1
TAG POS=1 TYPE=BUTTON FORM=ID:artform ATTR=ID:ArtSubmitButton
=> ... then that would give for example stg like:

Code: Select all

'Check if Selector for the 'MOUSEMOVE' is present:
TAB T=1
SET !EXTRACT NULL
TAG POS=1 TYPE=CANVAS ATTR=ID:js-canvas EXTRACT=TXT
SET Object_is_there EVAL("var s='{{!EXTRACT}}'; var x; if(s!='#EANF#'){x='#js-canvas';} else{x='BODY';}; x;")

'Check if Page loaded "correctly" and didn't trigger some "Connection Error" Page:
SET !EXTRACT NULL
TAG POS=1 TYPE=BUTTON ATTR=TXT:Try<SP>Again EXTRACT=TXT
SET Switch_TAB EVAL("var s='{{!EXTRACT}}'; var z; if(s=='Try Again'){z=2;} else{z=1;}; z;")

'Now we do the 'MOUSEMOVE':
TAB T={{Switch_TAB}}
EVENT TYPE=CLICK SELECTOR="#js-canvas" BUTTON=0
EVENT TYPE=MOUSEDOWN SELECTOR="#js-canvas" BUTTON=0
EVENTS TYPE=MOUSEMOVE SELECTOR="{{Object_is_there}}" POINTS="(303,275),(309,310),[...(truncated)...],(376,467),(374,476)"
EVENT TYPE=MOUSEUP POINT="(373,453)"

'Switch back to 'TAB_1':
TAB T=1
WAIT SECONDS = 1
TAG POS=1 TYPE=BUTTON FORM=ID:artform ATTR=ID:ArtSubmitButton
(Not tested...)

And you make sure when/before you launch your Macro (in 'TAB_1') that you already have a 2nd TAB open to the Right with any kind of Web-Page already ("correctly") loaded in it. Trying to open from your Script some 'google.com' Page is not very reliable, because if at that moment you've really lost your Internet Connection, the 'google.com' won't be able to load properly either and the Script will still hang on the 'MOUSEMOVE'...

And if you really want/prefer to handle the 'TAB_2' from your Script, then you can rather open some Local '.HTML' Page from your Computer, as it won't need any Internet Connection to open...
- (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...
kkipling5
Posts: 14
Joined: Sat Aug 03, 2019 7:29 am

Re: Workaround for 'EVENT' 'MOUSEMOVE' hanging on non-present Element/Selector.

Post by kkipling5 » Fri Aug 23, 2019 6:42 am

I tried the code you posted and everything seems to be working fine for now. Thanks a bunch!
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Workaround for 'EVENT' 'MOUSEMOVE' hanging on non-present Element/Selector.

Post by chivracq » Fri Aug 23, 2019 12:42 pm

kkipling5 wrote:
Fri Aug 23, 2019 6:42 am
I tried the code you posted and everything seems to be working fine for now. Thanks a bunch!

Alright, good to hear, Thanks for the Feedback..., and if you understood the "Principle", the Code is not difficult to modify/adapt to "other Needs", or to some (slightly) different (Error) Pages, if for example the "Try Again" Button I chose for the Check is not present or is called differently..., in some later FF Version for example... :wink:
- (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...
Post Reply