Pyinstaller Selenium不起作用--noconsole

问题描述

我有一个脚本,该脚本使用硒连接到网站并执行一些任务。我想使用pyinstaller转换为可执行文件,但是我不希望在运行.exe时显示任何控制台。当我使用以下命令创建.exe时:

pyinstaller --noconsole --onefile --icon="logo_icon.ico" bot.py

GUI加载但功能未执行,但是当我使用以下命令创建.exe时:

pyinstaller --onefile --icon="logo_icon.ico" bot.py

除了显示不需要的终端窗口外,这还行得通。

我的bot.py脚本的前几行是:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
mobile_emulation = { "deviceName": "iPhone X" }
chrome_options.add_experimental_option("mobileEmulation",mobile_emulation)

driver = webdriver.Chrome(ChromeDriverManager().install(),options = chrome_options)
driver.get("https://tellonym.me/login?redirect=/tells")

哪个安装了Chrome驱动程序,据我所知,不需要将其作为文件包含在pyinstaller中。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)