Check three times if the website is loaded, in case the refresh icon is flickering

This commit is contained in:
Kuba Orlik 2022-07-08 09:08:45 +02:00
parent 29b7244422
commit 72cd33001e

View File

@ -135,16 +135,7 @@ wait_for_pixel_color(){
done done
} }
load_website(){ wait_for_website_to_load(){
URL=$1
keycombo Control_L l
grab ctrl+l
xdotool type "$URL"
grab type url
xdotool key Return
grab enter
sleep 1
echo "{\"current_action\": \"waiting for $URL to load...\"}"
times=0 times=0
while [ $(get_pixel_color 143 122) = "#2e3436" ] # the center of the X icon that becomes a "refresh" icon once the website is finished loading while [ $(get_pixel_color 143 122) = "#2e3436" ] # the center of the X icon that becomes a "refresh" icon once the website is finished loading
do do
@ -158,6 +149,23 @@ load_website(){
break; break;
fi fi
done done
}
load_website(){
URL=$1
keycombo Control_L l
grab ctrl+l
xdotool type "$URL"
grab type url
xdotool key Return
grab enter
sleep 1
echo "{\"current_action\": \"waiting for $URL to load...\"}"
wait_for_website_to_load
sleep 0.3
wait_for_website_to_load
sleep 0.3
wait_for_website_to_load
sleep 5 # sometimes the consent modal needs a little time to show up sleep 5 # sometimes the consent modal needs a little time to show up
echo "{\"current_action\": \"website loaded\"}" echo "{\"current_action\": \"website loaded\"}"
} }