@@ -67,14 +67,16 @@ function reportNew {
6767function takeScreenshot {
6868 local URL=" $1 "
6969 local DELAY=" $2 "
70- local ELEMENT=" $3 "
71- " $SCREENSHOT_SCRIPT " " $URL " latest.png " $DELAY " " $ELEMENT "
70+ local CAPTURE_ELEMENT=" $3 "
71+ local CLICK_ELEMENT=" $4 "
72+ local WAIT_ELEMENT=" $5 "
73+ " $SCREENSHOT_SCRIPT " " $URL " latest.png " $DELAY " " $CAPTURE_ELEMENT " " $CLICK_ELEMENT " " $WAIT_ELEMENT "
7274
7375 # On Error, retry once
7476 if [ ! -f latest.png ]; then
7577 echo " Error taking screenshot. Retrying..."
7678 sleep 0.2
77- " $SCREENSHOT_SCRIPT " " $URL " latest.png " $DELAY " " $ELEMENT "
79+ " $SCREENSHOT_SCRIPT " " $URL " latest.png " $DELAY " " $CAPTURE_ELEMENT " " $CLICK_ELEMENT " " $WAIT_ELEMENT "
7880 fi
7981}
8082
@@ -119,7 +121,7 @@ function screenshotsMatch {
119121 # We first have to delete the changed screenshot (otherwise we cannot confirm that taking the second screenshot was a success)
120122 rm -f latest.png
121123 sleep 1
122- takeScreenshot " $URL " " $DELAY " " $ELEMENT "
124+ takeScreenshot " $URL " " $DELAY " " $CAPTURE_ELEMENT " " $CLICK_ELEMENT " " $WAIT_ELEMENT "
123125 # If no luck taking the second screenshot, abort
124126 if [ ! -f latest.png ]; then
125127 # Roll back the screenshot and report an error
@@ -165,12 +167,14 @@ while IFS='' read -r line || [ -n "${line}" ]; do
165167 WIDTH=$( echo $line | cut -d ' ,' -f4)
166168 HEIGHT=$( echo $line | cut -d ' ,' -f5)
167169 DELAY=$( echo $line | cut -d ' ,' -f6)
168- ELEMENT=$( echo $line | cut -d ' ,' -f7)
169- CHAT_ID=$( echo $line | cut -d ' ,' -f8)
170- URL=$( echo $line | cut -d ' ,' -f9-)
170+ CAPTURE_ELEMENT=$( echo $line | cut -d ' ,' -f7)
171+ CLICK_ELEMENT=$( echo $line | cut -d ' ,' -f8)
172+ WAIT_ELEMENT=$( echo $line | cut -d ' ,' -f9)
173+ CHAT_ID=$( echo $line | cut -d ' ,' -f10)
174+ URL=$( echo $line | cut -d ' ,' -f11-)
171175
172176 echo " Checking $URL "
173-
177+
174178 # As image directory, we use the name and chat id to create unique directories
175179
176180 # Create the image directory, if it does not exist yet
@@ -191,7 +195,7 @@ while IFS='' read -r line || [ -n "${line}" ]; do
191195 # ######################
192196
193197 # Take the screenshot
194- takeScreenshot " $URL " " $DELAY " " $ELEMENT "
198+ takeScreenshot " $URL " " $DELAY " " $CAPTURE_ELEMENT " " $CLICK_ELEMENT " " $WAIT_ELEMENT "
195199
196200 # If no luck taking the screenshot, abort
197201 if [ ! -f latest.png ]; then
0 commit comments