Pyinstaller & Selenium: When chromedriver is called, a blank chromedriver console window appears

618 views Asked by At

I have a pyinstaller exe program that takes user input from a tkinter GUI, then uses Selenium Chromedriver to find some data using the input, then displays the results in the GUI.

When I run the exe, there's a blank chromedriver console window that pops up after the user presses the button that calls on chromedriver. This blank console window doesn't appear when the script is run from the command line.

  • I used the --noconsole pyinstaller flag. This got rid of the python console window that usually appears when the exe is launched.

  • Per this SO question, I used the following option to get rid of a 'DevTools listening on...' message that popped up in a console window when Chromedriver was called:

    chrome_options.add_experimental_option('excludeSwitches', ['enable-logging'])

    This got rid of that window, but now a blank console window appears instead. The title bar of this console window is the path to chromedriver.exe.

  • I'm using Webdriver Manager to keep chromedriver up to date as Chrome is updated. I didn't have these console windows popping up until I started using Webdriver Manager instead of manually installing and defining the path to Chromedriver.

    browser = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options)

How can I suppress this blank Chromedriver window from appearing when Chromedriver is called? Is there a pyinstaller option that prevents ANY console windows from opening? I just want the GUI to show.

0

There are 0 answers