diff --git a/browser_manager.py b/browser_manager.py index 042d259..1c54eb2 100644 --- a/browser_manager.py +++ b/browser_manager.py @@ -44,6 +44,9 @@ def start_browser(use_tor=False, headless=False): options = uc.ChromeOptions() + if headless: + options.add_argument('--disable-gpu') + options.add_argument('--no-first-run') options.add_argument('--password-store=basic') diff --git a/page_viewer.py b/page_viewer.py index 0228381..3951820 100644 --- a/page_viewer.py +++ b/page_viewer.py @@ -106,8 +106,8 @@ def get_possibile_webelements(driver): def click(driver, by, desc, timeout): WebDriverWait(driver, timeout).until(EC.element_to_be_clickable((by, desc))).click() -def launch_and_visit(use_tor, page_url): - driver, tor_process = browser_manager.start_browser(use_tor=use_tor) +def launch_and_visit(use_tor, page_url, headless=False): + driver, tor_process = browser_manager.start_browser(use_tor=use_tor, headless=headless) visit_page(driver, page_url) time.sleep(5) @@ -115,4 +115,4 @@ def launch_and_visit(use_tor, page_url): browser_manager.close_browser(driver, tor_process) if __name__ == "__main__": - launch_and_visit(use_tor=True, page_url='https://giangillorossi.altervista.org') \ No newline at end of file + launch_and_visit(use_tor=True, page_url='https://giangillorossi.altervista.org', headless=False) \ No newline at end of file