问题描述
这是我在 Microsoft Edge Chromium 浏览器中使用 Selenium 时使用的代码:
This is the code I used for using Selenium with Microsoft Edge Chromium browser:
from selenium.webdriver.edge.options import Options
from selenium.webdriver.edge.service import Service
from selenium.webdriver.edge.webdriver import WebDriver
driveroptions = Options()
driveroptions.use_chromium = True
driveroptions.add_argument('--start-maximized')
driveroptions.binary_location = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
service = Service(executable_path="msedgedriver.exe")
driver = webdriver.Edge(options=driveroptions, service=service)
每当我重新启动系统时,我在任务管理器下的启动中得到 100 多个 msedge.exe 并得到 100 多个 msedge.exe 命令提示符的弹出窗口,例如 弹出窗口图片.我使用 Autoruns 从启动中删除了它们,但在重新启动后我又得到了它们.有没有其他人遇到过这个问题?
And whenever I restart the system, I get more than 100 msedge.exe in the startup under Task Manager and get 100s of popups of msedge.exe command prompt like this Popups picture. I deleted them from the startup with Autoruns but I got them again after restart. Has anyone else encountered this issue?
推荐答案
有同样的问题 - 在Startup Apps"中禁用 Microsoft Edge 实例有帮助,但每次程序运行时都会创建新实例...
Had the same issue - disabling Microsoft Edge instances in "Startup Apps" helped but new instances got created every time the program runs...
使用 MSDN 推荐的 msedge-selenium-tools 解决(https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium?tabs=python)
Solved by using msedge-selenium-tools as recommended by MSDN (https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium?tabs=python)
问题已经好几天没有出现了.
Issue hasn't cropped up in several days.
示例代码:
from msedge.selenium_tools import Edge, EdgeOptions
driverOptions = EdgeOptions()
driverOptions.use_chromium = True
driverOptions.binary_location = r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
driverOptions.add_argument("--headless")
driverOptions.add_experimental_option("excludeSwitches", ["enable-logging"])
driver = Edge(options=driverOptions)
#... use your driver
driver.close()
driver.quit()
做了一些更多的测试,看起来它只是driverOptions.add_experimental_option(excludeSwitches", [enable-logging"])"解决了这个问题.(不使用 msedge.selenium_tools).
Did some more testing and it looks like it is just the "driverOptions.add_experimental_option("excludeSwitches", ["enable-logging"])" that fixes this issue. (NOT using msedge.selenium_tools).
这篇关于我正在将 Microsoft Edge Chromium 与 Selenium 结合使用,并且一直将 msedge.exe 作为启动项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!