简体   繁体   English

执行python后cmd窗口没有关闭

[英]cmd window does not close after executing python

I have a bat file that used to execute powershell scripts and using the EXIT it would at the end close the cmd window.我有一个 bat 文件,用于执行 powershell 脚本并使用 EXIT 最后关闭 cmd 窗口。 Since i switched the powershells with python-selenium scripts it completely ignores all the EXITs and stays open forever.因为我用 python-selenium 脚本切换了 powershell,它完全忽略了所有的退出并永远保持打开状态。 Any ideas to close the window?关闭窗口的任何想法?

in the BAT:在 BAT 中:

C:\Users\...\python.exe C:\Users\...\seleniumskript.py
EXIT

The EXIT does not execute... EXIT 不执行...

The python script:蟒蛇脚本:

from selenium.webdriver import Edge
driver = Edge()
...doing stuff
driver.close()
quit()

Your chromedriver.exe is still running in background.您的chromedriver.exe仍在后台运行。 You should try a replacement:您应该尝试更换:

type browser.quit() instead of browser.close() .输入browser.quit()而不是browser.close()

This will let the chromedriver.exe to close correctly.这将使chromedriver.exe正确关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM