Skip to content

Commit

Permalink
Move headless mode to config
Browse files Browse the repository at this point in the history
  • Loading branch information
ranjan-mohanty committed May 7, 2024
1 parent c0a1dea commit cb592d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ interval = 180

[browser]
type = firefox
headless = true

[notification]
channels = email
Expand Down
5 changes: 4 additions & 1 deletion vfs_appointment_bot/vfs_bot/vfs_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def run(self, args: argparse.Namespace = None) -> bool:
# Configuration values
try:
browser_type = get_config_value("browser", "type", "firefox")
headless_mode = get_config_value("browser", "headless", "True")
url_key = self.source_country_code + "-" + self.destination_country_code
vfs_url = get_config_value("vfs-url", url_key)
except KeyError as e:
Expand All @@ -70,7 +71,9 @@ def run(self, args: argparse.Namespace = None) -> bool:

# Launch browser and perform actions
with sync_playwright() as p:
browser = getattr(p, browser_type).launch(headless=True)
browser = getattr(p, browser_type).launch(
headless=headless_mode in ("True", "true")
)
page = browser.new_page()
stealth_sync(page)

Expand Down

0 comments on commit cb592d4

Please sign in to comment.