Python+msedge.selenium_tools+edge加载拓展和用户数据

1.首先准备你需要的.crx拓展

 2.

 from msedge.selenium_tools import EdgeOptions, Edge
options = EdgeOptions()
options.use_chromium = True
#options.add_argument('--headless')

#加载拓展 options.add_extension(r
'C:Users**Documentsilcoelkkcokgeeijnopjnolmmighnppp_v7.0.0.crx')

#加载用户数据,
--user-data-dir=C:\ 中间不能有空格
#options.add_argument("--user-data-dir=C:\Users\17866\AppData\Local\Microsoft\Edge\User Data")

driver = Edge(options= options, executable_path='.msedgedriver.exe')

3.you get it!

原文地址:https://www.cnblogs.com/zhengbao/p/14991833.html