selenium webdriver错误(无法获取自动化扩展)

yftpprvb  于 2021-07-03  发布在  Java
关注(0)|答案(2)|浏览(292)

当我试图用chrome(v60)捕获SeleniumWebDriver屏幕截图时,我面临以下问题。我使用selenium网格运行测试,屏幕截图机制在firefox上运行良好。

org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
  (Session info: chrome=60.0.3112.113)
  (Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.34 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
1tu0hz3e

1tu0hz3e1#

您需要最新版本的chromedriver.exe。https://sites.google.com/a/chromium.org/chromedriver/downloads
chromedriver版本57需要此功能+
我也有同样的问题。一旦我更新了chromedriver版本,一切又恢复了正常。
希望对您有所帮助:)

2eafrhcq

2eafrhcq2#

使用 ChromeOptions 类来实现这一点。
请尝试以下代码:

ChromeOptions coptions = new ChromeOptions();
coptions.addArguments("enable-automation");
coptions.addArguments("--disable-infobars");
WebDriver driver = new ChromeDriver(coptions);

相关问题