当前位置: 首页 > 知识库问答 >
问题:

我如何使用vba中的chrome选项与Selenium?

丁阳羽
2023-03-14

有没有办法我可以使用那些注释掉的四行在我的vba代码,这样我可以摆脱障碍,而进入一些通知倾向的网页。我找不到任何想法,使我将能够利用他们,因为它是投掷错误,因为他们现在的情况。在这儿。提前道谢。

Sub Test_stth()
Dim driver As New WebDriver

'chrome_options = WebDriver.ChromeOptions()
'prefs = {"profile.default_content_setting_values.notifications" : 2}
'chrome_options.add_experimental_option("prefs",prefs)
'driver = WebDriver.Chrome(chrome_options = chrome_options)

With driver
    .Start "chrome", "https://stackoverflow.com/documentation"
    .get "/documentation"
End With
End Sub

共有1个答案

蓬弘
2023-03-14

这是你要找的吗?

With driver
    .SetPreference "profile.default_content_setting_values.notifications", 2 '1 for allow 2 for block
    .Start "chrome", "https://www.facebook.com"
.
.
.
 类似资料:
  • 问题内容: 在python-selenium chrome_options中,以下两个选项之间的区别到底是什么?我知道这两个选项都运行selenium脚本而不打开浏览器。 问题答案: 你看对了。添加参数会以 无头* 模式 启动 Chrome浏览器上下文 。 * 但是,该参数的目的 是在Windows平台上启用google-chrome- headless 。由于SwiftShader 较早在Win

  • 问题内容: 新标签页正在打开,但URL链接未打开。 问题答案: 我检查了以下代码,它对我来说很好。我从这里找到了答案。

  • 这是我正在使用的,用户代理可以成功设置,而下载首选项不能。 Windows 7、Chrome 26、Selenium-dotnet-2.31。2,chromedriver_win_26.0。1383 取自chromedriver。日志: 检查temp首选项文件在,没有设置和。

  • 我正在打开一个页面,执行一些操作,我正在使用这段代码在下一个选项卡中打开另一个链接 字符串url=“https://qa.logfireapps.com/lgf_700_qa_rf”; String args1=String.format(“window.open(”%s“,”%s“);”,url,“new”); ((JavascriptExecutor)driver).ExecuteScript

  • 本文向大家介绍如何使用Python将选项传递给Selenium Chrome驱动程序?,包括了如何使用Python将选项传递给Selenium Chrome驱动程序?的使用技巧和注意事项,需要的朋友参考一下 我们可以使用Python将选项传递给Selenium Chrome驱动程序。这可以借助ChromeOptions和DesiredCapabilities类的帮助。对于ChromeOptions