# 使用Edge不加载图片进行
from msedge.selenium_tools import Edge,EdgeOptions
Edge_options = EdgeOptions()
# 很关键的一步👇👇👇,只有为True才能进行ADD
Edge_options.use_chromium =True
No_Image_loading = {"profile.managed_default_content_settings.images": 2}
Edge_options.add_experimental_option("prefs",No_Image_loading)
# Edge_options.add_argument("headless")
driver = Edge(executable_path=driver_url,options=Edge_options)
driver.get('https://www.baidu.com')
需要下载msedge.selenium_tools,使用这个工具进行自动化测试,因为原有的Webdriver里面没有Options这个函数。