Is it possible to wait for the page to load completely, before continuing the snippet commands?
I'm using the simple 'wait' command, but sometimes the page takes to much to load, then I receive an error of Text Blaze extension.
Hi @Renato_Ribeiro ,
Can you use {site} command with a selector to fetch a common element in the website which renders at the end. Now you can just wrap the snippet contents in a {if} command to wait for the element to show up.
Something like
{isloaded=catch({site: text; selector=.selector}, "") <> ""}
{if: isloaded}snippet......{else}Loading....{endif}
Hey @Renato_Ribeiro ,
Sorry for the oversight. Seems my previous recommendation will not work. Currently there is no way to wait for the page to load.
Can you help me understand why you need to wait for the page to load completely?
Hi, @VinodGubbala!
Why the previous suggestion will not work?
I need to wait for the page load because some buttons appear only when the load finish.
I'm using the 'wait' command, but when the site are overloaded, the page load takes too much time that when the site are under normal circunstances. Then I need to modify the seconds inserted in all the 'wait' commands.
Are you trying to wait to click on these buttons. If yes,
we have introduced max_delay which should solve this.
{click: selector=#id; maxdelay=+4s}
This snippet click on the element with selector #id
, and wait for the element to appear upto 4 seconds.
Thank you man, it's exactly what I need.
One more doubt: is it possible to insert a variable in the place of '+4s'? That way I can easily modify all the max delays in snippet.
You can use something like
{delay=10}{click: selector=.user-menu-tab:not(.active); maxdelay={=delay & "s"}}
or
{delay="10s"}{click: selector=.user-menu-tab:not(.active); maxdelay={=delay}}
Perfect, man! Thank you so much.