Accept permission request in chrome using selenium

后端 未结 8 1819
旧巷少年郎
旧巷少年郎 2020-12-10 06:37

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

8条回答
  •  心在旅途
    2020-12-10 06:59

    [Java]: Yes there is a simple technique to click on Allow button using Robot-java.awt

    public void allowGEOLocationCapture(){
        Robot robot = null;
        try {
            robot = new Robot();
            robot.keyPress(KeyEvent.VK_TAB);
            robot.keyPress(KeyEvent.VK_ENTER);
            robot.delay(600);
        } catch (AWTException e) {
           getLogger().info(e);
        }
     }
    

提交回复
热议问题