如何允许或拒绝通知地理位置麦克风摄像头弹出 [英] How to allow or deny notification geo-location microphone camera pop up

查看:161
本文介绍了如何允许或拒绝通知地理位置麦克风摄像头弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法单击访问摄像机身份验证的允许按钮.

I'm not able to click on Allow button of access camera authentication pop up.

这是弹出的外观.

推荐答案

Allow Block 通知 Microphone Selenium 进行strong>, Camera GeoLocation Notification 访问,您必须使用ChromeOptions类,如下所示:

To Allow or Block the notification of Microphone, Camera, GeoLocation, Notification access using Selenium you have to use ChromeOptions Class as follows :

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

opt = Options()
opt.add_argument("--disable-infobars")
opt.add_argument("start-maximized")
opt.add_argument("--disable-extensions")
# Pass the argument 1 to allow and 2 to block
opt.add_experimental_option("prefs", { \
    "profile.default_content_setting_values.media_stream_mic": 1, 
    "profile.default_content_setting_values.media_stream_camera": 1,
    "profile.default_content_setting_values.geolocation": 1, 
    "profile.default_content_setting_values.notifications": 1 
  })

driver = webdriver.Chrome(chrome_options=opt, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()

这篇关于如何允许或拒绝通知地理位置麦克风摄像头弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆