0

~/.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.

Mario Palumbo
  • 693
  • 8
  • 32
  • why do you expect selenium to print stuff when it successfully downloaded something? Most libraries are quiet by default, if everything printed something anytime something worked, even simple programs would just be tons of noise. You can check the result of the get and add a `print` yourself. – Boris Verkhovskiy Mar 28 '21 at 20:09
  • I am a novice with chromedriver. How should I print? – Mario Palumbo Mar 28 '21 at 20:24
  • You print using `print("some text")`, but in this case selenium doesn't have a way of telling you that a file has finished downloading https://stackoverflow.com/questions/34338897/python-selenium-find-out-when-a-download-has-completed – Boris Verkhovskiy Mar 28 '21 at 22:27

0 Answers0