Skip to content

Commit

Permalink
Added command line argument --no-headless
Browse files Browse the repository at this point in the history
  • Loading branch information
rzc0d3r authored Jan 4, 2024
1 parent ce50a0c commit 9826c13
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
██╔══╝ ╚════██║██╔══╝ ██║ ██╔═██╗ ██╔══╝ ╚██╔╝ ██║ ██║██╔══╝ ██║╚██╗██║
███████╗███████║███████╗ ██║ ██║ ██╗███████╗ ██║ ╚██████╔╝███████╗██║ ╚████║
╚══════╝╚══════╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝
Project Version: v1.2.0.0
Project Version: v1.2.0.1
Project Devs: rzc0d3r, AdityaGarg8, k0re,
Fasjeit, alejanpa17
"""
Expand Down Expand Up @@ -80,12 +80,12 @@ def chrome_driver_installer_menu(): # auto updating or installing chrome driver
sys.argv.append('--force')
driver = None
if '--firefox' in sys.argv:
driver = shared_tools.initSeleniumWebDriver('firefox')
driver = shared_tools.initSeleniumWebDriver('firefox', headless=('--no-headless' not in sys.argv))
else:
chromedriver_path = chrome_driver_installer_menu()
if chromedriver_path is not None:
os.chmod(chromedriver_path, 0o777)
driver = shared_tools.initSeleniumWebDriver('chrome', chromedriver_path)
driver = shared_tools.initSeleniumWebDriver('chrome', chromedriver_path, headless=('--no-headless' not in sys.argv))
only_account = False
if '--account' in sys.argv:
logger.console_log('\n-- Account Generator --\n')
Expand Down
8 changes: 5 additions & 3 deletions modules/shared_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ def untilConditionExecute(chrome_driver_obj: Chrome, js: str, delay=DEFAULT_DELA
def createPassword(length):
return ''.join(['Xx0$']+[random.choice(string.ascii_letters) for _ in range(length)])

def initSeleniumWebDriver(browser_name: str, webdriver_path = None):
def initSeleniumWebDriver(browser_name: str, webdriver_path = None, headless=True):
driver_options = None
driver = None
if browser_name.lower() == 'chrome':
driver_options = ChromeOptions()
driver_options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver_options.add_argument("--log-level=3")
driver_options.add_argument("--lang=en-US")
driver_options.add_argument('--headless')
if headless:
driver_options.add_argument('--headless')
driver_service = ChromeService(executable_path=webdriver_path)
if os.name == 'posix': # For Linux
if sys.platform.startswith('linux'):
Expand All @@ -86,7 +87,8 @@ def initSeleniumWebDriver(browser_name: str, webdriver_path = None):
driver_options = FirefoxOptions()
driver_service = FirefoxService(executable_path=webdriver_path)
driver_options.set_preference('intl.accept_languages', 'en-US')
driver_options.add_argument('--headless')
if headless:
driver_options.add_argument('--headless')
if os.name == 'posix': # For Linux
if sys.platform.startswith('linux'):
console_log('Initializing firefox-driver for Linux', INFO)
Expand Down
1 change: 1 addition & 0 deletions wiki/CommandLineArguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
| --force | disabled | Disables all user input, but waiting for the Enter key to be pressed before exiting the program remains |
| --cli | disabled | Disables all user input (GitHub CI Requirements) |
| --firefox | disabled | Launching the project via firefox browser (Runs through the chrome browser by default) |
| --no-headless | disabled | Shows the browser at runtime (by default hides the browser at runtime) |

0 comments on commit 9826c13

Please sign in to comment.