From c243961df5d7311d5e6bbd0754079638dec5f191 Mon Sep 17 00:00:00 2001 From: Graham Helton Date: Sun, 3 Oct 2021 19:04:15 -0400 Subject: [PATCH] Added silent mode --- README.md | 5 +++++ happySnake.py | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 629269a..6db35b1 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,11 @@ pip3 install selenium colorama ``` # Usage To run simple create a file called config.json in the directory above where you installed the tool (Please don't put a config.json in a git directory...). I recommend not testing with real info until you're sure this behaves how you expect it to. +### Silent mode +Runs firefox in headless mode. (Does not open the browser) +```python +python3 happySnake.py -s +```` # Example ![](example.gif) diff --git a/happySnake.py b/happySnake.py index ac762c1..fe9d598 100755 --- a/happySnake.py +++ b/happySnake.py @@ -7,6 +7,7 @@ from selenium.webdriver.support.select import Select from colorama import init, Fore, Style import json import time +import sys #Initialize variables and get config with open('../config.json') as configFile: data=json.load(configFile) @@ -37,7 +38,9 @@ print(Fore.GREEN + def goToParent(): driver.switch_to.parent_frame(); -#options.add_argument("--headless") +if "-s" in sys.argv: + options.add_argument("--headless") + driver = webdriver.Firefox(options=options) driver.get("https://happymugcoffee.com/collections/roasted-coffee")