Skip to content

Commit

Permalink
add time to wait before taking a screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
shreejalmaharjan-27 committed Apr 1, 2024
1 parent 75b484f commit 3d2e185
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from selenium.webdriver.common.keys import Keys

from cog import BasePredictor, Input, Path
import time


class Predictor(BasePredictor):
Expand All @@ -27,9 +28,17 @@ def predict(
description="Height of the screenshot",
default=1080
),
wait_until: int = Input(
description="Time in seconds to wait before a screenshot is taken",
default=0
)
) -> Path:
self.browser.set_window_size(w, h)
self.browser.get(url)
if wait_until > 0:
for i in range(wait_until):
print(f"Elapsed time: {i+1}/{wait_until} seconds")
time.sleep(1)

# debug details
print(f"Page title: {self.browser.title}")
Expand Down

0 comments on commit 3d2e185

Please sign in to comment.