A little bit of smarter checks instead of blind sleeps
This commit is contained in:
parent
ae0f6fde8d
commit
a0fea094f5
@ -92,20 +92,22 @@ start_firefox(){
|
||||
FIREFOX_PID=$!
|
||||
while [ $(get_pixel_color 100 100) = "NONE" ]
|
||||
do
|
||||
echo "waiting for firefox to open the window"
|
||||
sleep 0.1
|
||||
done;
|
||||
echo "firefox opened the window"
|
||||
}
|
||||
|
||||
prepare_firefox(){
|
||||
xdotool key Return # in case there's a "firefox closed unexpectedly" button
|
||||
sleep 1
|
||||
grab "after sleep 1"
|
||||
# xdotool key Return # in case there's a "firefox closed unexpectedly" button
|
||||
# sleep 1
|
||||
# grab "after sleep 1"
|
||||
click 1886 13 #maximize button
|
||||
grab "after maximize"
|
||||
sleep 1
|
||||
grab "after sleep 1"
|
||||
FIREFOX_WIDTH=$(wmctrl -lpG | grep Firefox | awk '{print $6}')
|
||||
while [ "$FIREFOX_WIDTH" != "2880" ]
|
||||
do
|
||||
sleep 0.1
|
||||
done
|
||||
#grab "after sleep 1"
|
||||
# no need to reopen the network tab, as it's almost certainly already open
|
||||
# keycombo Control_L Shift_L e
|
||||
# grab "after ctrl+shift+e"
|
||||
@ -121,9 +123,15 @@ wait_for_pixel_color(){
|
||||
y=$2;
|
||||
color=$3;
|
||||
timeout=$4;
|
||||
while [ $(get_pixel_color 143 122) = "#2e3436" ]
|
||||
start=$(timestamp)
|
||||
while [ $(get_pixel_color 143 122) != "$color" ]
|
||||
do
|
||||
sleep 0.1
|
||||
ts=$(timestamp)
|
||||
if [ $(( ts - start )) -gt $(( timeout * 1000 )) ]
|
||||
then
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@ -155,7 +163,7 @@ load_website(){
|
||||
|
||||
open_network_inspector(){
|
||||
keycombo Shift_L F5 #profiler
|
||||
sleep 1
|
||||
wait_for_pixel_color 1777 152 0a84ff 3
|
||||
keycombo Control_L Shift_L e
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user