Added silent mode

main
Graham Helton 3 years ago
parent 8b78481ea1
commit c243961df5

@ -6,6 +6,11 @@ pip3 install selenium colorama
``` ```
# Usage # 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. 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
![](example.gif) ![](example.gif)

@ -7,6 +7,7 @@ from selenium.webdriver.support.select import Select
from colorama import init, Fore, Style from colorama import init, Fore, Style
import json import json
import time import time
import sys
#Initialize variables and get config #Initialize variables and get config
with open('../config.json') as configFile: with open('../config.json') as configFile:
data=json.load(configFile) data=json.load(configFile)
@ -37,7 +38,9 @@ print(Fore.GREEN +
def goToParent(): def goToParent():
driver.switch_to.parent_frame(); driver.switch_to.parent_frame();
#options.add_argument("--headless") if "-s" in sys.argv:
options.add_argument("--headless")
driver = webdriver.Firefox(options=options) driver = webdriver.Firefox(options=options)
driver.get("https://happymugcoffee.com/collections/roasted-coffee") driver.get("https://happymugcoffee.com/collections/roasted-coffee")

Loading…
Cancel
Save