Unexpected Timeout of Macros

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
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
mlenz
Posts: 4
Joined: Thu Mar 25, 2021 9:14 am

Unexpected Timeout of Macros

Post by mlenz » Thu Mar 25, 2021 11:11 am

dear customer support (and users),

i am using the following iMacros versions:
-for Chrome version 1010 with chrome 89.0.4389.90 (64 bit)
-for Firefox version 12021450 with firefox 87.0 (64 bit)

- all under windows 10 pro version 1903
- the demo macros work ok, and i am using the COM-scripting interface via python

I am having issues under chrome and firefox.
When first navigating to the site, a cookie consent dialog has to be accepted.
after that, google analytics- and other cookies are set.

the following TAG-Commands to click the consent button did not work, i assume because the dialog is loaded via AJAX.

'TAG POS=1 TYPE=BUTTON ATTR=TXT:"Alles akzeptieren"
'TAG XPATH="//*[@id="uc-center-container"]/div/footer/div/div/div/button"

' source code:
'<button type="button" backgroundcolor="[object Object]" data-testid="uc-accept-all-button" fullwidth="true" class="sc-bdnylx gFQyGs">Alles akzeptieren</button>

Error Message in both cases: RuntimeError: element BUTTON specified by ... was not found (-721)



so i am now using the following macro to automatically click the accept button of the dialog via javascript.


URL GOTO=...
WAIT SECONDS=5
URL GOTO=javascript:if(!(document.cookie.indexOf('_ga')>=0)){try{document.getElementById('usercentrics-root').shadowRoot.querySelectorAll("button[data-testid='uc-accept-all-button']")[0].click();}catch(e){console.log(e);}}


this works, but the playback of following macros does not continue and i get a timeout instead.
error message: Error while receiving response. (error code -3)
chivracq
Posts: 9715
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Unexpected Timeout of Macros

Post by chivracq » Thu Mar 25, 2021 11:54 am

mlenz wrote:
Thu Mar 25, 2021 11:11 am
dear customer support (and users),

i am using the following iMacros versions:

Code: Select all

 -for Chrome version 1010 with chrome 89.0.4389.90 (64 bit)
 -for Firefox version 12021450 with firefox 87.0 (64 bit)

- all under windows 10 pro version 1903
- the demo macros work ok, and i am using the COM-scripting interface via python
I am having issues under chrome and firefox.
When first navigating to the site, a cookie consent dialog has to be accepted.
after that, google analytics- and other cookies are set.

the following TAG-Commands to click the consent button did not work, i assume because the dialog is loaded via AJAX.

Code: Select all

'TAG POS=1 TYPE=BUTTON ATTR=TXT:"Alles akzeptieren"
'TAG XPATH="//*[@id="uc-center-container"]/div/footer/div/div/div/button"

' source code:

Code: Select all

		'<button type="button" backgroundcolor="[object Object]" data-testid="uc-accept-all-button" fullwidth="true" class="sc-bdnylx gFQyGs">Alles akzeptieren</button>
Error Message in both cases:

Code: Select all

RuntimeError: element BUTTON specified by ... was not found (-721)

so i am now using the following macro to automatically click the accept button of the dialog via javascript.

Code: Select all

		URL GOTO=...
        WAIT SECONDS=5
        URL GOTO=javascript:if(!(document.cookie.indexOf('_ga')>=0)){try{document.getElementById('usercentrics-root').shadowRoot.querySelectorAll("button[data-testid='uc-accept-all-button']")[0].click();}catch(e){console.log(e);}}


this works, but the playback of following macros does not continue and i get a timeout instead.
error message:

Code: Select all

Error while receiving response. (error code -3)

You could have also tried the 'EVENT' Mode in v10.1.0 for CR to accept the Cookies, it usually works fine with Ajaxy Elements... (But not supported in v10.0.2 for FF...)

Then, hum OK..., "Error Code -3" is an 'iimPlay()' Error from the 'Scripting Interface'...
You could add 'iimGetErrorText()' to see if you get "more Info" about the Error...

And can you mention your 'SI' Version...?
+ 'FIO' (Local File Access) Module Version...?

... And maybe post your "main" Python Script...?
And how/where do you run it...?

If I understand correctly, the 1st Sub-Macro finishes correctly, and it's the 2nd Sub-Macro that never runs and returns the "-3" Error, like the 'SI' has "lost contact" with the Browser...
- (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...
mlenz
Posts: 4
Joined: Thu Mar 25, 2021 9:14 am

Re: Unexpected Timeout of Macros

Post by mlenz » Thu Mar 25, 2021 12:45 pm

First of all, thank you for your help :)

The Scripting interface version is: 1260017764
iMacros File Access version is: 10.1.0.1465

I tried the EVENT command you recommended:

EVENT TYPE=CLICK XPATH="//*[@id="uc-center-container"]/div/footer/div/div/div/button"

it returns a RuntimeError: The message port closed before a response was received. (-1001)

and you are understanding correctly, the 1st Sub-Macro finishes correctly, and it's the 2nd Sub-Macro that never runs and returns the "-3" Error, like the 'SI' has "lost contact" with the Browser...
unfortunately i can't provide you with a URL because it is an internal project.
chivracq
Posts: 9715
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Unexpected Timeout of Macros

Post by chivracq » Thu Mar 25, 2021 1:18 pm

mlenz wrote:
Thu Mar 25, 2021 12:45 pm
First of all, thank you for your help :)

Code: Select all

The Scripting interface version is: 1260017764
iMacros File Access version is: 10.1.0.1465
I tried the EVENT command you recommended:

Code: Select all

EVENT TYPE=CLICK XPATH="//*[@id="uc-center-container"]/div/footer/div/div/div/button"
it returns a

Code: Select all

RuntimeError: The message port closed before a response was received. (-1001)
and you are understanding correctly, the 1st Sub-Macro finishes correctly, and it's the 2nd Sub-Macro that never runs and returns the "-3" Error, like the 'SI' has "lost contact" with the Browser...
unfortunately i can't provide you with a URL because it is an internal project.

OK, your 'SI' + 'FIO' Versions look "correct" to me (in combination with v10.1.0 for CR + v10.0.2 for FF)...

>>>

'EVENT' Mode, hum OK...
Never seen this "The message port closed before a response was received." Error before, and it's not documented in the Wiki..., and "strangely enough", Error "-1001" is a FF Error, but the 'EVENT' Mode is not supported in v10.0.2 for FF, so I "take for granted" you ran your Test in v10.1.0 for CR, ah-ah...! :?
Then hum, OK, maybe that's a "new" Runtime Error from v10.1.0 for CR, and it was not documented in the Wiki... :?

>>>

"unfortunately i can't provide you with a URL because it is an internal project."
=> Hum, OK, I was not asking for an URL but for your "main" '.py' Script, so that "we" can see the Workflow in that Script, and how you use 'iimPlay(Code)()' and other 'iimXXX()' Commands etc..., but OK, fair enough... :|

Alright, I'm not very knowledgeable with the 'SI' (that I don't use myself), and even less with 'Python' as there are not many Threads on the Forum involving 'Python', well..., and you didn't post any Script anyway, ah-ah...!, but I will ping @TechSup if they want to have a Look... :P

( :arrow: And hum..., they will probably move your Thread to the 'Scripting Interface' Sub-Forum...)
- (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...
mlenz
Posts: 4
Joined: Thu Mar 25, 2021 9:14 am

Re: Unexpected Timeout of Macros

Post by mlenz » Mon Mar 29, 2021 8:13 am

dear chivracq, thanks again for your help.
here are the relevant parts of my python script, as you requested. I create an instance of the Macros class (see macros_class.png in the attachments) in the main script and use it in main(). (see main.png)
Attachments
main.png
macros_class.png
Tom, Tech Support
Posts: 3678
Joined: Mon May 31, 2010 4:59 pm

Re: Unexpected Timeout of Macros

Post by Tom, Tech Support » Mon Mar 29, 2021 1:59 pm

Hi mlenz,

Are you able to do some other navigation or maybe a REFRESH after the URL GOTO that accepts the cookies? You might want to try putting a small WAIT after this URL GOTO also. I'm just thinking that maybe there is some sort of timing issue when attempting to execute that javascript at the very end of the macro.
Regards,

Tom, iMacros Support
mlenz
Posts: 4
Joined: Thu Mar 25, 2021 9:14 am

Re: Unexpected Timeout of Macros

Post by mlenz » Tue Mar 30, 2021 7:58 am

Hi Tom and thanks,
i tried a WAIT command as well as a refresh. neither seems to solve the problem. the next macro does sometimes start to play and sometimes it doesn't. but most of the time i get "Playing iMacro failed: Error while receiving response"
Post Reply