Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在selenium和java中禁用/删除chrome无头免责声明_Java_Selenium_Google Chrome Headless - Fatal编程技术网

如何在selenium和java中禁用/删除chrome无头免责声明

如何在selenium和java中禁用/删除chrome无头免责声明,java,selenium,google-chrome-headless,Java,Selenium,Google Chrome Headless,我已经自动化了一个页面,并通过“Chromeheadless”运行,脚本处于无限循环中,因为有一个chrome自动化免责声明,在该声明下,要单击的实际元素存在 自动化页面附在下面: 使chrome成为无头的自动化代码如下: String chromePath = getChromeDriverPath(); System.setProperty("webdriver.chrome.driver", chromePath); C

我已经自动化了一个页面,并通过“Chromeheadless”运行,脚本处于无限循环中,因为有一个chrome自动化免责声明,在该声明下,要单击的实际元素存在

自动化页面附在下面:

使chrome成为无头的自动化代码如下:

String chromePath = getChromeDriverPath();
            System.setProperty("webdriver.chrome.driver", chromePath);
            ChromeOptions options = new ChromeOptions();
            options.addArguments("--headless", "--disable-gpu", "--window-size=1920,1200","--ignore-certificate-errors");
            options.addArguments("disable-infobars");
             driver = new ChromeDriver(options);

如果我使用普通的chrome驱动程序运行脚本,它工作正常。只有铬合金无头模式的问题。请帮助我如何禁用/删除免责声明以继续执行。

您必须确保您的chrome驱动程序版本与您的chrome浏览器版本兼容。感谢munge的回复,它在正常模式下工作正常。只有无头模式才能收到通知。我的Chrome浏览器和驱动程序都是84版本,你的selenium版本是什么?chromePath的值是多少?您使用的是Google Chrome还是Chrome浏览器?您好,我使用的是selenium 3.141.59版本。在Chromepath中,我有chrome驱动程序的位置,并获取该位置并设置系统属性。