问题
Is there any way I can use those commented out four lines in my vba code so that I can shake off barrier while entering some notifications prone webpages. I can't find any idea so that I will be able to make use of them as it is throwing error because of how they are now. Here it is. Thanks in advance.
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:
Is this what you are looking for?
With driver
.SetPreference "profile.default_content_setting_values.notifications", 2 '1 for allow 2 for block
.Start "chrome", "https://www.facebook.com"
.
.
.
来源:https://stackoverflow.com/questions/45121955/how-can-i-use-chrome-options-in-vba-with-selenium