I am using Microsoft Edge Chromium with Selenium and I keep on getting the msedge.exe as a startup item

时光总嘲笑我的痴心妄想 提交于 2020-12-27 06:35:31

问题


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)

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?


回答1:


Had the same issue - disabling Microsoft Edge instances in "Startup Apps" helped but new instances got created every time the program runs...

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.

Example code:

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()

EDIT:

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).



来源:https://stackoverflow.com/questions/63800954/i-am-using-microsoft-edge-chromium-with-selenium-and-i-keep-on-getting-the-msedg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!