简体   繁体   中英

Selenium Webdriver Error (Cannot get automation extension) while taking screenshot on Chrome

I am facing following issue when trying to capture Selenium Webdriver screenshot with Chrome (v60). I am running my tests using Selenium Grid and the screenshot mechanism works fine for 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'

Use ChromeOptions class to achieve this.

Try this below code:

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

You need the latest version of chromedriver.exe. https://sites.google.com/a/chromium.org/chromedriver/downloads

This is needed for chromedriver version 57+

I was having this same issue. Once I updated the chromedriver version everything worked again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM