使用硒在铬中接受许可请求 [英] Accept permission request in chrome using selenium

查看:121
本文介绍了使用硒在铬中接受许可请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用google web语音API的HTML / Javascript文件,我正在使用硒进行测试,但是每次进入该网站时,浏览器都会请求使用我的麦克风,并且必须点击允许。



我如何让selenium自动点击ALLOW?

解决方案

@ExperimentsWithCode



再次感谢您的回答,我今天几乎花了整整一天的时间试图弄清楚如何做到这一点,并且我也尝试了您的建议, flag - disable-user-media-security 改为chrome,遗憾的是它并不适合我。



然而,我想到了一个非常简单的解决方案:



要自动点击允许所有我必须做的是按三次TAB键,然后按回车键。所以我编写了这个程序来自动完成这个工作,并且它能够工作!

当我的html页面打开时,第一个TAB指向我的输入框,第二个指向地址栏,第三个指向ALLOW按钮,然后Enter按钮按下。

python程序使用硒以及PyWin32绑定。






感谢您抽出宝贵时间,尽力帮助我,非常感谢。


I have a HTML/Javascript file with google's web speech api and I'm doing testing using selenium, however everytime I enter the site the browser requests permission to use my microphone and I have to click on 'ALLOW'.

How do I make selenium click on ALLOW automatically ?

解决方案

@ExperimentsWithCode

Thank you for your answer again, I have spent almost the whole day today trying to figure out how to do this and I've also tried your suggestion where you add that flag --disable-user-media-security to chrome, unfortunately it didn't work for me.

However I thought of a really simple solution:

To automatically click on Allow all I have to do is press TAB key three times and then press enter. And so I have written the program to do that automatically and it WORKS !!!

The first TAB pressed when my html page opens directs me to my input box, the second to the address bar and the third on the ALLOW button, then the Enter button is pressed.

The python program uses selenium as well as PyWin32 bindings.


Thank you for taking your time and trying to help me it is much appreciated.

这篇关于使用硒在铬中接受许可请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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