简体   繁体   English

如何在Python / Selenium中关闭麦克风/相机弹出窗口?

[英]How can I close the microphone/camera popup in Python / Selenium?

在此输入图像描述

I want to click block. 我想点击块。 I tried this: 我试过这个:

alert = browser.switch_to_alert()
alert.dismiss();

However it says that there is no alert open. 但它表示没有警报开放。 I think it's not considered as an alert? 我认为它不被视为警报?

To get rid of the Microphone/Camera popup you can use the following arguments from ChromeOptions Class : 要摆脱Microphone/Camera弹出窗口,您可以使用ChromeOptions Class的以下arguments

  • Java solution: Java解决方案:

     ChromeOptions options = new ChromeOptions(); options.addArguments("allow-file-access-from-files"); options.addArguments("use-fake-device-for-media-stream"); options.addArguments("use-fake-ui-for-media-stream"); WebDriver driver = new ChromeDriver(options); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM