add option for headless browser
parent
56530c96c7
commit
5b299b20d7
|
@ -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')
|
||||
|
||||
|
|
|
@ -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')
|
||||
launch_and_visit(use_tor=True, page_url='https://giangillorossi.altervista.org', headless=False)
|
Loading…
Reference in New Issue