如何设置硒中Edge()的铬的选项?

Vthechamp

我一直在学习教程,使用Firefox,使用Options(),我可以在定义浏览器(browser = Firefox(options=opts)时设置无头模式,但适用于Firefox我为新的Chrome Edge下载了驱动程序,但似乎无法在中设置options=关键字Edge()谁能告诉我在定义浏览器时如何设置选项?

from selenium.webdriver import Edge
from selenium.webdriver.edge.options import Options

opts = Options()
opts.headless = True
browser = Edge(options=opts)
#              ^^^^^

似乎没有options关键字,但出现错误:

Traceback (most recent call last):
  File ".\tutorial.py", line 6, in <module>
    browser = Edge(options=opts)
TypeError: __init__() got an unexpected keyword argument 'options'

任何帮助将不胜感激。提前致谢!

CodePuppet

对于Edge Chromium,您需要为python安装msedge-selenium-tools软件包,然后可以初始化驱动程序

options = EdgeOptions()
options.use_chromium = True

driver = Edge(options)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章