chromedriver in headless mode does not show any textual output of the operations done

84 Views Asked by At

~/.pythonrc:

def get_chromedriver(headless = False):
    import os
    from selenium import webdriver
    options = webdriver.ChromeOptions()
    options.binary_location = '/usr/bin/google-chrome'
    options.add_argument('user-data-dir=' + os.environ['HOME'] + '/.config/google-chrome')
    options.add_experimental_option('detach', True)
    options.add_experimental_option('excludeSwitches', ['enable-automation'])
    options.add_experimental_option('useAutomationExtension', False)
    options.headless = headless
    driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver', options=options)
    return driver

In the interactive prompt I typed:

Chrome = get_chromedriver(True)
Chrome.get("http://www.africau.edu/images/default/sample.pdf")

And the file has been successfully downloaded to my current directory, but there is no console output that allows me to orient myself in my operations.
is this expected behavior?
is it possible to get console output for each of my operations?
I'm on an interactive prompt and not in a script.

0

There are 0 best solutions below