如何在Python/Selenium中关闭麦克风/摄像头弹出窗口?
我要单击“阻止”。我试过这个:如何在Python/Selenium中关闭麦克风/摄像头弹出窗口?,python,selenium,Python,Selenium,我要单击“阻止”。我试过这个: alert = browser.switch_to_alert() alert.dismiss(); 然而,它说没有警报打开。我认为它不被视为警报?要摆脱麦克风/摄像头弹出窗口,您可以使用色度选项类中的以下参数: Java解决方案: ChromeOptions options = new ChromeOptions(); options.addArguments("allow-file-access-from-files"); options.addArgum
alert = browser.switch_to_alert()
alert.dismiss();
然而,它说没有警报打开。我认为它不被视为警报?要摆脱
麦克风/摄像头
弹出窗口,您可以使用色度选项
类中的以下参数
:
- 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);